Case sensitivity

Alex Martelli aleax at aleax.it
Fri Feb 21 16:54:08 EST 2003


John Roth wrote:
   ...
>> why he or she needs to memorize (or continuosly check or
>> try) that the functions named (e.g.) 'today', 'localtime',
>> or 'add_century' MUST be lowercase, while (e.g.) functions
>> 'TimeFrom' and 'Age' and 'Time' MUST be mixed-case.  Pah.
> 
> It seems to be an excellent opportunity for a homily on the
> virtues of a consistent nameing convention.
> 
> I suppose most of us know the utility of a bad example in
> illustrating a point.

I think Marc-Andre has explained perfectly well why he
believes his naming convention is quite consistent -- he
distinguishes between "functions and utilities" on one
side and "object constructors" (and classes, but here I'm
only dealing with functions) on the other.  And I think he
did as well as feasible *within the constraints of a
case-sensitive language*.  There's a reason why mx.DateTime
is so popular: it IS rather powerful and well-designed!

The problem still remains for the poor occasional user who 
must memorize on which side of the divide have been classes
the inevitably many functions that could be taken one way
or another, such as 'today' and 'Age'.  That burden is
imposed on him or her by the fact that Python is case
sensitive, NOT by "bad examples" on the part of library
designers.  And I suspect I'm not the only Pythonista
who's wasted some time tracking down silly case mismatches
in spelling cStringIO.StringIO, HTMLParser, HTTPSHandler,
BaseHTTPRequestHandler, CGIHTTPServer and various other
sundry MandatorilyMixedCaseMarvelsOfOurAge ... oh well, sigh.


Alex





More information about the Python-list mailing list