why no camelCase in PEP 8?

Peter J. Holzer hjp-python at hjp.at
Fri May 29 16:24:25 EDT 2020


On 2020-05-29 06:27:31 +1000, Chris Angelico wrote:
> On Fri, May 29, 2020 at 6:20 AM Peter J. Holzer <hjp-python at hjp.at> 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.
[...]
> The OP said:
> > My preference for using camelCase (in PEP 8, AKA mixedCase) is
> > putting me at odds with my colleagues, who point to PEP 8 as "the
> > rules".
> >
> 
> This smells like the incredibly strong misconception that PEP 8 needs
> to govern every line of Python code ever written, or else it's "bad
> code". This thread wouldn't have been started if it had been any other
> style guide that the company had been chosen, because then it's
> obvious that the choice is the company's. It's only when PEP 8 is
> considered to be some sort of universal standard that we get this kind
> of discussion.

I got a bit side-tracked in my previous reply, so I'm trying to stick to my
original point more closely this time.

Your claim was that "nobody ever requires you to comply with [PEP 8] for
any other code".

For this claim to be false, only one person/company/project needs to
require somebody to comply with PEP 8. Their motives are completely
irrelevant. They may believe that compliance with PEP 8 is necessary
for any Python code. They may just think that PEP 8 is a good idea. They
may have had a vision of Elvis singing the text of PEP 8 to the tune of
Jailhouse Rock. It doesn't matter. Your claim was about their actions,
not their motives.

The OP seems to feel that he is required by his colleagues to comply
with PEP 8. So his company would serve as a counter-example (though
maybe a weak one, since it doesn't seem to be a hard requirement).

        hp

PS: We have "PEP 8, unless you have a good reason to deviate" in our
style guide, but we don't enforce that at all (unfortunately).

-- 
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | hjp at hjp.at         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20200529/356b04d4/attachment.sig>


More information about the Python-list mailing list