Yet Another Case Question

Martijn Faassen m.faassen at vet.uu.nl
Mon Feb 24 19:11:25 EST 2003


Alex Martelli <aleax at aleax.it> wrote:
> IF Python was case-insensitive, you might freely PRETEND the
> convention was universally applied, spelling that particular
> constant as math.PI in your code for example.  As things stand
> (and will keep standing, alas), you cannot even pretend: you
> must inherently acknowledge every time you use something as
> fundamental as standard module math that the convention is in
> fact broken all over the place.

Of course I could pretend:

mymath.py

from math import pi as PI

And then use mymath from then on. The pretending is just a lot more
explicit than your implicit changing of case. :) Now if I were just writing 
a little module and my use of PI was incidental I wouldn't do that, true. But 
if I were writing a math-intensive framework I very well might.

>  Quite a way from "enforcing"!!! 

If the standard library dealt with cases consistently, it would be enforcing
the client use to also use the same consistent spelling. The standard library's
use of case is however inconsistent. Your argument could therefore be that
Any library/framework will automatically grow case-inconsistent over time.
I don't really believe that this is the case; while I'm sure some exceptions
will tend to creep into frameworks I do believe that it's quite possible
to have a consistent case-spelling style. I believe in fact that this is
the case in the Java world; they came with a set of conventions early
on and I believe most libraries tend to follow this.

The standard library is rather special in that it is an accumulation of 
modules contributed by a wide range of people, some of which were developed 
before various conventions were established in the Python community, and that
we don't dare changing now because it would break lots of code.

[snip lots of stuff about Alex worrying about having to memorize 
audiodev]

I never used audiodev. I sympathize with your pain in having to go through
the trouble of memorizing its ins and outs. I take it you do a lot 
with audio on Suns and SGIs. :)

Regards,

Martijn
-- 
History of the 20th Century: WW1, WW2, WW3?
No, WWW -- Could we be going in the right direction?




More information about the Python-list mailing list