[Tutor] Naming conventions (was: Should this be a list comprehension or something?

Jacob S. keridee at jayco.net
Sat Jan 29 04:54:08 CET 2005


You're my best friend. Everyone else looves camelCase, and I hate it too. It 
doesn't make sense. It doesn't fit English.
It doesn't fit Spanish. It doesn't fit any other language AFAIK, so why 
should a human (who uses spoken language) to computer interpreter use a 
naming convention that doesn't match spoken language? That's my opinion.

Jacob Schmidt


> On Wed, 26 Jan 2005, Sean Perry wrote:
>
>> 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.
>
> I hate hate hate hate hate camelcase and will never use it.  In my book,
> if the name has *any* capitals in it, the first letter is capitalized,
> too.  Anything else is unaesthetic.
>
> To me, when I have names that are composed of multiple words (say, "rice
> quantity"), I have two approaches: distinguishing the words by case
> (RiceQuantity) or separating by underscores (rice_quantity).
>
> I never confuse classes/instances and methods, because I use noun phrases
> for classes and instances (HeatedWater, VerifiedInput) and verb phrases
> for the methods (CombineWater, CookRice).  I suppose I could get
> confusion, for example, when the combination either a noun phrase or
> verb phrase (SoundOut: is that a name describing the Sound that's being
> put Out, or is it a method that's is tentatively Sounding Out somthing?)
> but so far that hasn't been an issue for me.
>
> Of course in my case, I write code only for myself, so I have the luxury
> of not worrying about what Joe in the next cubicle is doing, and what Jane
> will do when she's trying to read Bob's and my code together.  So I have
> the luxury of turning my nose up at camelCase.
>
> I should add that, the one time I made changes to someone else's Python
> code for release (a minor patch to nntplib.py), I used the same case
> conventions already in place in the module.
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
> 



More information about the Tutor mailing list