[Tutor] Should this be a list comprehension or something?
Brian van den Broek
bvande at po-box.mcgill.ca
Fri Jan 28 05:47:01 CET 2005
Tony Meyer said unto the world upon 2005-01-27 21:46:
> [Sean Perry]
>
>>>And now, for the pedant in me. I would recommend against naming
>>>functions with initial capital letters. In many languages, this
>>>implies a new type (like your Water class). so
>>>CombineWater should be combineWater.
>
>
> [Brian van den Broek]
>
>>Do you mean implies by the dominant coding conventions, or
>>by language syntax? (Indulging the curious pedant in me.)
>
>
> You might want to read PEP 8, which is the official recommendations for
> Python code in terms of style. A bit more than half way down there's a
> "Naming Conventions" section which has this:
>
> <http://www.python.org/peps/pep-0008.html>
<SNIP PEP quote>
> (BTW, 'CombineWater' should be 'combine_water', officially).
>
> =Tony.Meyer
Hi,
thanks for the reference and to all else who've responded. I was just
curious about Sean's statement and wondered if there were languages
which enforced some naming scheme. (Sean pointed to Erlang, which I
don't think I'd heard of before.)
I am aware of PEP 8, and have read it a few times. I don't tend to
feel constrained by it though I do seem mostly in accord. And,
judging by the code I've read, not feeling constrained by it seems
pretty widespread in the Python community.
I've only been writing classes for a month or so, and if I cannot get
a good one word Name, I've been Naming_them_thusly. That works for me
as I do always use names_with_underscores for functions. I don't
really like them either, but, iLikeThe AlternativesEvenLess.
Oh wait, I know: let's all start writing code in MS Word .doc format!
Arial for functions, Times New Roman for classes. Who's with me? ;-)
Best to all,
Brian vdB
More information about the Tutor
mailing list