Pythonic Programming: Tip 5 contradicts PEP 8

@aqsaqal

Tip 5 contains the following text:

Use mixedCase identifiers for variables, functions, and modules.

From the Python Style Guide, PEP 8 -- Style Guide for Python Code | Python.org

Package and Module Names
Modules should have short, all-lowercase names. Underscores can be used in the module name if it improves readability. Python packages should also have short, all-lowercase names, although the use of underscores is discouraged.

Function and Variable Names

Function names should be lowercase, with words separated by underscores as necessary to improve readability.

Variable names follow the same convention as function names.

mixedCase is allowed only in contexts where that’s already the prevailing style (e.g. threading.py), to retain backwards compatibility.

A good catch, thanks!

I came here exactly to ask about this. I just started reading this book and I’m reading that I should use mixedCase?

Even threading module has now introduced snake cased methods.

@onyx-and-iris I think that the author, Dmitry Zinoviev, @aqsaqal has acknowledged this as an error and will fix it if we do another printing. Dmitry–is that accurate?

1 Like