[Python-Dev] PEP 8 and function names
ncoghlan at gmail.com
Sun May 26 12:34:46 CEST 2013
On Sun, May 26, 2013 at 7:48 PM, Sébastien Durand <se8.and at gmail.com> wrote:
> Hi all,
> "There should be one-- and preferably only one --obvious way to do it."
> We all love this mantra.
> But one thing that often confuses people : function naming. The standard
> library is kind of inconsistent. Some functions are separated by underscores
> and others aren't. It's not intuitive and new pythonistas end up constantly
> reading the doc. (Time saving one char typing vs time guessing function
> Would it be a good idea to clarify PEP 8 on this ? I mean for future
As far as I am aware, there's nothing to clarify: new code should use
underscores as word separators, code added to an existing module or
based on existing API should follow the conventions of that module or
API. This is what PEP 8 already says.
The standard library is inconsistent because it's a 20 year old code
base with severe backwards compatibility constraints, and much of it
was written before there was even a PEP process, let alone PEP 8.
We did do one wholesale conversion to PEP 8 compliance (for the
threading module) and decided the cost/benefit ratio was too low to
justify ever doing that again. We do have a general guideline
requiring PEP 8 compliance for *new* modules added to the standard
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
More information about the Python-Dev