case-sensitivity
Alex Martelli
aleax at aleax.it
Thu Nov 13 09:26:42 EST 2003
Ron Adam wrote:
...
> If an option for case insensitivity were implemented it would just be
> a matter of doing a lower() function on all source code as a first
> step in the compile process. Then case in the source code need not
> matter, or you could choose to have it matter if that's what you want.
> It probably isn't that simple. I haven't looked into the source code
> far enough yet. Doing so would probably cause errors in existing
> programs where names do use same spelling/different case for different
And all uses of standard Python modules such as random and fileinput,
which do exactly that sort of thing systematically.
> Using a case correcting editor is one way of doing it that doesn't
> change pythons core and lets the programmer choose the behavior they
> want.
Nope, can't do. Consider:
>>> import random
>>> x=random.Random()
>>> y=random.random()
now x and y are two VERY different things:
>>> x
<random.Random object at 0x81aa9d4>
>>> y
0.93572104869999828
...but how would a poor "case correcting editor" distinguish them...?
Such a smart editor might HELP a little by SUGGESTING a case-correction
when it appears unambiguous, even just for standard modules and the
functions therein. Maybe a menu-command for "suggest case corrections
if any" WOULD be helpful in IDLE, and offer good cost/benefit ratio as
a fun, not-too-terribly-hard project reducing human misery a bit...:-).
Alex
More information about the Python-list
mailing list