Language change and code breaks

Paul Prescod paulp at ActiveState.com
Fri Jul 20 13:38:19 EDT 2001


James Logajan wrote:
> 
> Guido van Rossum wrote:
> > If you use this
> > a lot (message = Message() etc.) your code is less readable than it
> > should be.
> 
> Um, you've got that precisely reversed! If I see "message" anywhere in my
> code, I know immediately that it is an instance of the class Message. Think
> of it as an advanced form of Hungarian notation that tells you what type of
> thing the variable is holding. (Although I'm no fan of Hungarian per se.)

The Ruby convention is aMessage which is really more clear. i.e.
"message" could be of type string or of type Unicode or anything. I'm
sure I've got code on my computer where message was of any of these
types.

After all, lower case names are not ALWAYS used for instances of a type.
Sometimes they are merely descriptive of the variable's role. If you are
trying to say that an instance is an instance of a class then the aFoo
convention is very clear.

-- 
Take a recipe. Leave a recipe.  
Python Cookbook!  http://www.ActiveState.com/pythoncookbook




More information about the Python-list mailing list