Python style guidelines

Greg Ewing (using wmwd2zz02 at
Mon Mar 15 01:39:05 CET 2004

MetalOne wrote:
> I finally agree that long unabbreviated names are better.  Years later,
> I realize that expressions can be hard to read with long variable
> names.  It occurs to me that mathematics always use one character
> variables like x,y,z or the greek symbols.

I think the important thing is not to use *arbitrary*
abbreviations. There is usually more than one plausible
way to abbreviate a long word to a medium-size word.
Remembering that it's abbreviated and exactly how it's
abbreviated is a cognitive burden that one can do without.
Deciding on no abbreviations cuts out a whole lot of
degrees of freedom that provide little benefit.

Extremely short names in the mathematics style are something
else, I think -- not so much abbreviations as a different
approach to naming altogether. It often makes sense,
especially if the names tie in with symbols used in
mathematics literature on the subject.

Also, local names are different from global ones. It
probably doesn't matter much what sort of names you
use locally, but global ones need to be as memorable
as possible. Descriptive, fully-spelled-out names
seem to be best for that.

Greg Ewing, Computer Science Dept,
University of Canterbury,	
Christchurch, New Zealand

More information about the Python-list mailing list