Case sensitivity/insensitivity

Christian Tanzer tanzer at
Sat May 20 02:24:19 EDT 2000

Courageous <jkraska1 at> wrote:

> The occasions in which you really want to have variables/
> attributes which differ by case alone are quite rare. About
> the only time I have ever seen this regularly is in some
> types of code where accessors (in c++/java) differed from
> private attributes only in case, ala:
> class Myclass
> {
> 	private int      myvar;
> 	int Myvar();
> }
> I can't really see any other real use of actual case sensitivity
> in the language. Does anyone out there actually make use of
> case sensitivity?

FWIW, I use case sensitivity in at least two situations:

- I start class names with a capital letter, instance names are lower
  case. In my code, quite often an instance has the `same' name as a

  Of course, I could've used the `a_' prefix. But it's too late
  for that now.

- Several of my classes have names whose lower case equivalents clash
  with Python keywords.

  For instance, one of my class hierarchies models C constructs. One
  of these classes has the name `If'.

  Go case sensitivity, come syntax error:

    >>> class If : pass
    >>> class if : pass
      File "<stdin>", line 1
        class if : pass
    SyntaxError: invalid syntax

  IMO, tacking a prefix or postfix onto the name of such a class

Christian Tanzer                                         tanzer at
Glasauergasse 32                                       Tel: +43 1 876 62 36
A-1130 Vienna, Austria                                 Fax: +43 1 877 66 92

More information about the Python-list mailing list