Language change and code breaks

Scherer, Bill Bill.Scherer at VerizonWireless.com
Fri Jul 20 13:49:13 EDT 2001


On Fri, 20 Jul 2001, Paul Prescod wrote:

> 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.

I'll venture that this is a SmallTalk convention, that the Ruby folk
wisely picked up on.  Almost every bit of Smalltalk I've ever seen used
this 'convention'.  Maybe it predates Smalltalk too.

>
> 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.
>
>

William K. Scherer
Sr. Member of Applications Staff - Verizon Wireless
Bill.Scherer_at_VerizonWireless.com





More information about the Python-list mailing list