Case insensitivity

Michael Ströder michael at stroeder.com
Fri Jul 20 04:15:23 EDT 2001


Guido van Rossum wrote:
> 
> It has been argued that making Python case-insensitive would be
> "dumbing it down".  I find this a strange argument.  It doesn't take
> any power away

In my case I sometimes have to deal with ASN.1 types. The convention
in ASN.1 is that type names are written with a first capital letter
and an attribute of the type has the same name with first letter
lower-cased. My certificate parser maps the ASN.1 types 1:1 to
Python classes and the attributes 1:1 to class attributes. Because I
don't want to introduce an extra name mapping I use the ASN.1 type
names as class names and the ASN.1 attribute names as class
attribute names. This makes it very easy for PKI people to read the
code.

As I understand this discussion it wouldn't be possible to write the
code in this form if Python will be case-insensitive in the future.
I would have to define an extra mapping from ASN.1 names to Python
class/attribute names => case-insensitivity takes power away because
less things can be expressed directly without defining an additional
name mapping.

> It's been argued that making string, String, STRING and StRiNg mean
> the same thing makes for less readable programs.  I agree.  A good
> programming environment should silently correct the case of
> identifiers as you type to conform to the definition.

Uuuh. Looking at the handling/displaying of file names under Windows
I'm not really keen to obey some kind of "automatic" mechanism for
case-insensitivity. There are so many error-prone semi-automatic
mechanisms out there claiming to make my life easier. But actually
work doesn't get easier...

>  This also means
> that you can still use different case conventions to hint about what
> type of identifier it is, e.g. MACRO, Class, variable.

But I can't use

class MyClass:
  pass

myClass = MyClass()

> It's been argued that it's convenient to be able to write c = C(),
> where C is a class and c is an instance of that class.  Surely there
> are other conventions we can use.

But this convention exists in other non-Python name spaces. And to
keep things simple I'd like to map these name spaces 1:1 as
described with ASN.1 example above. IMHO things will get
significantly worse instead of easier.

> To me, the only real important question is, how can we introduce
> case-sensitivity for novices without breaking the millions of lines of
> existing Python code.  One option could be: forget it, it's too late.

Yes. (I really hope that you will choose this option.)

> Another: put the case-insensitivity in the tools.

No. I'm usually mistrusting automatic tools. Too many of them only
cover 98% of the cases. This might seem good but actually it's not.

Ciao, Michael.



More information about the Python-list mailing list