[Tutor] variable naming conventions

Ben Finney ben+python at benfinney.id.au
Sun Aug 16 10:14:27 CEST 2015


Laura Creighton <lac at openend.se> writes:

> The Python Standard Library, for the most part, uses underscores
> for variable names and CamelCase for class names.

Note a sharp distinction between camelCaseNames, which the Python
community eschews, versus TitleCaseNames, which are embraced for names
of classes.

> See PEP 008 for 'preferred Python Style' -- such as it is, but be
> aware that if you join a project it is more important to follow the
> conventions used there than to hop up and down saying ....'This is not
> PEP 008 !'

Yes. If you're looking for a style guide, choose PEP 8, because your
style will then be maximally familiar to others when you inevitably need
to collaborate with some other people.

If you're joining a community that doesn't have consistently-enforced,
coherent conventinos, make a strong push for PEP 8 for the same reason.

But if you're joining an existing community that has chosen a coherent
convention which it enforces consistently, go with that.

-- 
 \         “We demand rigidly defined areas of doubt and uncertainty!” |
  `\    —Vroomfondel, _The Hitch-Hiker's Guide To The Galaxy_, Douglas |
_o__)                                                            Adams |
Ben Finney



More information about the Tutor mailing list