Case sensitivity

David Mertz mertz at gnosis.cx
Sat Feb 22 00:46:18 CET 2003


Erik Max Francis <max at alcyone.com> wrote previously:
|My fundamental point when people talk about case-insensitive languages
|is this:  If there's no distinction between case made in the language,
|why let the user make it at all?
|Particularly in languages (including Python) where case formatting is
|often used as a convention to give a hint as to what type of thing
|something is (e.g., all uppercase is probably intended to be a
|constant).

In my past life, I spent about as much time writing in case-insensitive
langauges (Pascal, Fortran, xBase [mostly Clipper, some FoxPro, dBase,
etc], a little REXX) as I now have with Python.  Even after several
years, I slightly miss the case-insensitivity of those other
languages... but on balance, Python is still better than any of them.

In most of those languages, I used almost exactly the same casing
conventions I now do with Python.  'MAX' was intended as a
constant in any case.  Likewise, 'MyClass' was a class, and 'myinstance'
an instance.  Admittedly, in a case-insensitive language, you cannont
also have a 'max' variable when you have a 'MAX' constant.  But doing
that is mostly bad practice anyway.

That said, the one case convention I quite like in Python is the usage:

    class Something: ...
    something = Something()

Obviously, without case-sensitivity, we would have to use a different
convention for this distinction.

If anything though, the case-sensitivity seemed weakened by having
distinctions like this be only conventional.  I would probably like the
case-sensitivity better if Python was like Haskell in having mandatory
meanings for capitalization.  But then...  I probably wouldn't like
Python better as a whole with that change, since the word "mandatory" is
usually unpythonic.

Even though I think case-insensitivity would have been a better design
decision by Guido 11 years ago, it is far too late to impose it now.
There are just too many modules that would break, and just too much
documentation that discusses the actual situation (including my own
forthcoming book).  Changing the case handling at this point is moot.

Yours, David...

--
Keeping medicines from the bloodstreams of the sick; food from the bellies
of the hungry; books from the hands of the uneducated; technology from the
underdeveloped; and putting advocates of freedom in prisons.  Intellectual
property is to the 21st century what the slave trade was to the 16th.





More information about the Python-list mailing list