Re: [Tutor] variable naming conventions

2015-08-16 Thread Laura Creighton
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
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] variable naming conventions

2015-08-16 Thread Ben Finney
Laura Creighton l...@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

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] variable naming conventions

2015-08-15 Thread Joel Goldstick
On Sat, Aug 15, 2015 at 9:24 PM, D Wyatt fiberfo...@gmail.com wrote:
 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
 ___
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 https://mail.python.org/mailman/listinfo/tutor

lower case.  underscores


-- 
Joel Goldstick
http://joelgoldstick.com
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] variable naming conventions

2015-08-15 Thread Mark Lawrence

On 16/08/2015 02:24, D Wyatt wrote:

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,



If it's your code for your use do whatever you like.  I prefer camel 
case as it saves reaching for the SHIFT-MINUS combination, others detest 
it.  Even the famous PEP 8 (https://www.python.org/dev/peps/pep-0008/) 
is only a guide.


However if I was working on a project in collaboration with others I 
would certainly expect to stick with the standards that the project 
insisted on, even if I didn't like them personally.  Anybody who 
deliberately ignores standards in this situation should be hung, drawn 
and quartered after spending an extremely long amount of time in agony 
in The Comfy Chair :)


--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] variable naming conventions

2015-08-15 Thread Cameron Simpson

On 15Aug2015 18:24, D Wyatt fiberfo...@gmail.com wrote:

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.


PEP 8 is lowercase with underscores for normal variables. Class names tend to 
be CamelCase. I try to follow this. One advantage in staying with this is that 
you share this convention with the stdlib and with a lot of other Python code, 
which make it easier for you to read because it aligns with your own habits.  
Ideally, anyway.


If you're not invested in another style, and not working in someone else's 
codebase with its own conventions, try PEP 8.


Cheers,
Cameron Simpson c...@zip.com.au

Oh, what tangled webs we weave,
   when first we practice to deceive.
   And when we've practiced for awhile,
   How we do improve our style!- Dorothy Parker
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] variable naming conventions

2015-08-15 Thread D Wyatt
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
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor