Case-sensitivity: why -- or why not? (was Re: Damnation!)

benji_york at cal-na.com benji_york at cal-na.com
Tue Jun 6 10:18:47 EDT 2000


I've been following this thread on and off, so I'd bet someone else has
already expoused this point of view.  My initial reaction to the case-
insensitivity question was: "Great! Now I can impose my naming
conventions on other modules, and even the language itself."

I'm one of those who likes classes, member functions and stand-alone
functions to start with an upper-case letter and variables and member
variables a lower-case letter.

I'm not saying this is enough of a reason to change the language, but I
definitely see an advantage to not mixing naming conventions in my
modules just because I want to use someone else’s module that doesn't
name the same way I do.  In a production environment this can be quite
annoying (or it has been for me).

Example of what I would like to be able to do:

from Module import Thing

foo = Thing
for key in dict.Keys():
    if anotherDict.HasKey(key):
        print foo.NotTheOriginalCase(key)

Perhaps there is a better way to get the same result without being case-
insensitive.  A "case-mapping" directive or such, but that seems to
over-complicate things.

Along the same lines; identifiers could also ignore imbedded (not
leading or trailing) underscores, so I could use dict.HasKey() instead
of dict.has_key().

I think both of these suggestions have /some/ merit. After all,
identifiers carry meaning, so why not ignore those parts of the
identifier that carry little or no meaning to the reader.  If the
underscore in "has_key" is meant to separate words, why not let me
separate the words like "HasKey"?  This has the added advantage of
removing ambiguous situations where there are two names with the
same "human" meaning, but different "machine" meanings.

Some have said that this would make it harder for people just learning
Python, but in training the people where I work (long-time COBOL and
Fortran guys) I've found that the differences between dict.has_key()
and HTMLgen.TD() and pickle.dumps() causes some confusion.

Benji York


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list