Case sensitivity/insensitivity

Bernhard Herzog herzog at online.de
Sat May 20 11:03:40 EDT 2000


Courageous <jkraska1 at san.rr.com> writes:

> 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?

Well, can think of several cases where case sensitivity is useful for
me.

One is the case you describe above. I prefer accessor methods call MyVar
instead of get_my_var.

Another is that I often name constants in ALL_UPPERCASE and sometimes I
have local variables whose are all lowercase but otherwise the same as
that of some constant. These variables would hide those constants,
although it wouldn't be difficult to work around that.

Yet another is that I also sometimes like to name instances of classes
with lowercase versions of the (capitalized) class name.


The argument usually used in favor of case insensitivity is that it is
easier for beginners and the experiences with Alice seems to back that
up. I don't have the URL handy at the moment, but it should be easy to
find it from python.org.

I keep wondering, though, whether the cultural background might
influence this. In German for instance, all nouns are capitalized, not
just names and the first word of a sentence. That might make it easier
for a German student to learn a case sensitive language that for, say,
an American student. I have absolutely no idea whether that's true,
though.

-- 
Bernhard Herzog   | Sketch, a drawing program for Unix
herzog at online.de  | http://sketch.sourceforge.net/



More information about the Python-list mailing list