osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

why no camelCase in PEP 8?


On Tue, May 19, 2020 at 5:51 AM Lance E Sloan <sloanlance at gmail.com> wrote:
>
> I've been using Python for about 18 years.  Several things have changed in the language in those years.  I don't disagree with most of it, but one of the things that annoys me is the disapproval of using camelCase to name symbols such as variables, functions, etc.
>
> I think PEP 8, the "Style Guide for Python Code" (https://www.python.org/dev/peps/pep-0008/), came out shortly after I began using Python.  I think the old habits of the people I worked with and the relative lack of tools like Flake8 and Pylint led to the standard being ignored.  However, now I see many developers really want to adhere to the standard.
>
> 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".  I have reasons for my preferring camelCase.  I suspect the reasons the PEP 8 authors have for not using it are probably as strong as my reasons.  So our reasons probably nullify each other and what's left is simple preference.
>
> So, I'd like to know what was the reason behind favoring snake_case (AKA lower_case_with_underscores) in PEP 8 instead of camelCase.
>
> Does anyone in this group know?

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.

ChrisA