Case sensitivity

Greg Ewing (using news.cis.dfn.de) me at privacy.net
Mon Feb 24 21:30:22 EST 2003


Alex Martelli wrote:
> If you think so, then I believe you should reply to Marc
> Andre Lemburg's explanation of the rationale for that design
> in his followup to my post.  I happen to agree with Marc
> Andre that the rationale is sound

Marc, I'd like to apologise for any aspersions I may
have inadvertently cast on mxDateTime. I'm not
familiar with that particular module, and I was
taking at face value Alex's apparent suggestion that
it made random choices about use of case.

I now understand that the choices are not random, and
that there is a rationale behind them. But then, if
there is a clear rationale, the cases shouldn't be
so hard to remember as Alex was making out.

> Think of the issue more generally.  Classes by convention
> should have capitalized names, while functions have names
> that are lowercase.  So what we do for factory functions,
> which are, yes, functions, but also "constructors" for
> class instances?

Yes, I know situations like this occasionally arise. An
example occurs in Plex, where I have a bunch of things for
constructing regular expressions. Most of them are classes,
but a few are factory functions. I decided to make them
all start with an upper case letter, because as far as
the user is concerned, they're all constructors of one
kind or another.

But, in my experience, situations like this are rare, and
the vast majority of the time I don't have any problem
deciding whether something ought to start with an upper
case letter or not. *Most* things are either clearly
classes or clearly functions.

> And people who still have not
> entirely memorized the exact capitalization of every name
> exported by the module will get runtime errors

Again in my experience, it only requires getting to know
the conventions used by the authors of the modules I'm
using -- in other words, it's a per-module piece of
knowledge to memorise, not per-name. But perhaps I'm
lucky enough not to have encountered too many different
sets of conventions, or any that are too wacky to get
my head around. If Alex's experiences are different,
he may well see things differently.

-- 
Greg Ewing, Computer Science Dept,
University of Canterbury,	
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg





More information about the Python-list mailing list