why no camelCase in PEP 8?

Terry Reedy tjreedy at udel.edu
Thu May 28 18:14:53 EDT 2020


On 5/28/2020 4:18 PM, Peter J. Holzer wrote:
> On 2020-05-19 05:59:30 +1000, Chris Angelico wrote:
>> PEP 8 is a style guide for the Python standard library. It is the
>> rules you must comply with if you are submitting a patch *to Python
>> itself*. Nobody ever requires you to comply with it for any other
>> code.
> 
> That's obviously not true: Many companies and projects have a coding
> standard. Many of those coding standards will be based on or even
> identical to PEP 8. And as an employee or contributor you may be
> required to comply with it.

Revise Chris' claim to "Neither the PSF nor the Python core developers 
require* that owners of non-stdlib code comply with PEP 8" and it would 
be true.

* We could have, by baking it into the language, by making uppercase 
following lowercase in identifiers illegal.  But that would disabled 
part of the stdlib.

> Now you might argue that in this case you
> aren't required to comply with PEP 8, but with the coding standard of
> your company, but I would consider that excessive nitpickery.

I don't.  If an entity with a police force adopts part of the Model Fire 
Code written by an International Association of Fire Marshals (or 
whatever), it matters that any enforcement is done by that state's 
officials rather toothless disapproval of the association.

In any case, Guido as BDFL did not enforce the function-name rule, as 
illustrated by unittest (I would have prefered otherwise).  Moveover, he 
made it clear in PEP 8 that strict enforcement of its rules was not one 
of its rules.  Many of the rules explicitly allow for exceptions in 
exceptional circumstances.  So required no-exception compliance is an 
add-on by other entities.

-- 
Terry Jan Reedy



More information about the Python-list mailing list