[PyQt] Naming in PyQt programs and PEP8 naming convention

Florian Bruhin me at the-compiler.org
Wed Apr 1 14:50:47 BST 2020


Hey,

On Wed, Mar 04, 2020 at 08:34:31AM +0100, Gottfried Müller wrote:
> I am using the predefined pylint config file. There is the snake_case
> option activated. It looks strange combining the Qt names in camelCase
> with the snake_case option. Does anybody change the pylint config file
> and how?

Sorry for the late answer, this was lying around in my mailbox for a while and
I forgot about it.

You'll likely need to adjust the setting anyways, because you'll need to use
the camelCase convention when overriding virtual C++ methods from Qt (or even
just when calling methods of course).

The remaining question is whether to use snake_case for the Python part of your
codebase, or switch to camelCase (against PEP8) for everything.

I went for the former for my project, some projects like pytest-qt just expose
both (e.g. qtbot.add_widget() and qtbot.addWidget()) and let the user decide.

Here's my .pylintrc, though it's pretty permissive in general:
https://github.com/qutebrowser/qutebrowser/blob/v1.10.1/.pylintrc#L50

Florian

-- 
me at the-compiler.org (Mail/XMPP) | https://www.qutebrowser.org 
       https://bruhin.software/ | https://github.com/sponsors/The-Compiler/
       GPG: 916E B0C8 FD55 A072 | https://the-compiler.org/pubkey.asc
             I love long mails! | https://email.is-not-s.ms/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20200401/b93ddb69/attachment.sig>


More information about the PyQt mailing list