Case sensitivity/insensitivity

Will Rose cwr at crash.cts.com
Sat May 20 18:37:14 EDT 2000


Bernhard Herzog <herzog at online.de> wrote:
: 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.

For a single data point, I'm English (tho' German was my first language,
which spoils the 'statistics' a bit).  I don't think case-sensitive/
insensitive varies with nationality; I've run across similar arguments
in file-naming contexts (eg. Unix case-sensitive/case-preserving, and
Microsoft long filenames case-insensitive/case-preserving).  Some
people just do see the tokens 'token' and 'Token' as being identical,
and are very irate if their behaviour differs; others, like me, see
them as different and hate the additional complexity of trying to
memorise possible matches.  (A bit like the 6-character limit on old
linkers...).  I don't know why people have these two different approaches,
but it seems to be something fundamental in their use of language.

That being said, case-preserving/case-insensitive file systems are a
pain.  A case-preserving/case-insensitive language would be, especially
for large projects, a really major pain.  Given my druthers, I just
wouldn't use it.  Much better to make it monocase, if students have
difficulty - COBOL's still readable.

For small projects almost any language is useable; however, if you
really want a language for students, and only students, why not use
Logo or Pascal?  They already exist, and have good reputations in
that area.  Python is a more powerful and flexible language than
either of them, it appears to scale better, and it would seem a pity
to limit it to a lowest common denominator.

Will
cwr at cts.com





More information about the Python-list mailing list