[Tutor] variable naming conventions

Laura Creighton lac at openend.se
Sun Aug 16 09:00:37 CEST 2015


In a message of Sat, 15 Aug 2015 18:24:53 -0700, D Wyatt writes:
>It seems every book I read these days uses camel case for variable names in
>Python.  I was once told that using underscores is preferred.  Is there a
>preference in the Python community or does it really matter?  I'd like to
>instill good habits while I'm learning.
>
>Thanks in advance,
>-- 
>Deb Wyatt in WA

The Python Community is too large now to have only one preference.
People's preferences for CamelCase or this_uses_underscores is usually
language independent -- if you prefer it when you are using language
X, you probably prefer it when you are using langauge Y, too.

The Python Standard Library, for the most part, uses underscores
for variable names and CamelCase for class names.  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 !'

Laura


More information about the Tutor mailing list