Python book section "Functions Style Notes" written without awareness of PEP 8?

67 views
Skip to first unread message

Alex Huth

unread,
Mar 19, 2014, 12:24:00 PM3/19/14
to building-s...@googlegroups.com
I came across this page via Google:


And found a similar page (different edition?) at this URL:


PEP 8 is widely considered the definitive style guide for Python, so I'm curious as to why it's never mentioned in this section. There is a small discrepancy with regard to the use of mixedCase:

Function names are typically lower_case_with_underscores() or mixedCase(). A few important functions were once done in CapWords() style with a leading upper case letter. This can cause confusion with class names, consequently, the recommended style is a leading lowercase letter for function names.

Versus PEP 8:

Function names should be lowercase, with words separated by underscores as necessary to improve readability.
mixedCase is allowed only in contexts where that's already the prevailing style (e.g. threading.py), to retain backwards compatibility.


Best,
Alex

Alex Huth

unread,
Mar 19, 2014, 12:29:03 PM3/19/14
to building-s...@googlegroups.com
I should add, it's clear the author is generally aware of PEP 8 (example 1example 2). I would edit the title of this thread to change "written without awareness of" to "written without reference to" if I could figure out how.

Steven F. Lott

unread,
Mar 19, 2014, 1:41:20 PM3/19/14
to building-s...@googlegroups.com
Widely considered. May be true. Definitive is debatable. 

Universally followed -- even in the standard library -- is false. 

It's good to read critically. If you want to survey the standard library for level of compliance, that might be helpful. 

Sent from my iPhone
--
You received this message because you are subscribed to the Google Groups "Building Skills Books" group.
To unsubscribe from this group and stop receiving emails from it, send an email to building-skills-...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages