case-sensitivity

Ron Adam radam2 at tampabay.rr.com
Thu Nov 13 00:53:32 EST 2003


On Thu, 13 Nov 2003 02:12:38 GMT, "Rainer Deyke" <rainerd at eldwood.com>
wrote:

>Ron Adam wrote:
>> Which would you choose from the following?
>
>Here are the options I see, in order of preference:
>
>1. The compiler enforces a consistent capitalization scheme, preferably
>all_lower_case.  Note that MixedCase is only consistent if PsychoTheRapist
>is a different identifier than Psychotherapist.  Different syntactical
>elements (identifiers vs keywords) are allowed to use different schemes.

So to you, it is an advantage to be able to use names with the same
spelling and different case combinations for different things.   And
you prefer to let the compiler catch your errors when you try and run
your programs in a traditional code, compile, debug, repeat sequence.
Is that correct?

To me, I find the use of names spelled the same with caps in different
places, that are used for different things, to be ambiguous.   I would
also prefer as little repetitive debugging as possible.  

Not to mention my memory for spelling, including differing case
arrangements, is definitely not one of my strong points as you would
see if I didn't use a spelling checker.  So my preferences differ from
yours in this manner for personal reasons.  I don't think either of us
is alone in our views.


>2. Traditional case sensitivity: Bob and bOb are different identifiers.

So what is the difference between 'Bob' and 'bOb'?  I have no idea.
Even though they are supposedly following some consistent scheme, the
caps don't really help me that much.

 Since the bulk of python code is in the form of modules, many of
which are written by different people at different times,  and by
third parties,  it would be very difficult (if even possible) to
rename and enforce everything to follow a consistent naming scheme.


>3. Case insensitity.

Then 'Bob and 'bOb' would be the same thing.  Even though they look a
little different,  I can understand this.   Simple,  easy to remember,
easy to use.   


>What your editor does is an orthogonal issue and irrelevant to me; what my
>editor does is let me type what I want without correcting me.

And I believe that's the way it should be for you if that's what you
want.  That was options #1,#2, and #3 in my list.  

If an option for case insensitivity were implemented it would just be
a matter of doing a lower() function on all source code as a first
step in the compile process.  Then case in the source code need not
matter, or you could choose to have it matter if that's what you want.
It probably isn't that simple.   I haven't looked into the source code
far enough yet.   Doing so would probably cause errors in existing
programs where names do use same spelling/different case for different
things.  And it may also break calls to .dll's and .pyd files.  There
would also need to be a switch to turn it one way or the other for
compatibility purposes.   

Using a case correcting editor is one way of doing it that doesn't
change pythons core and lets the programmer choose the behavior they
want.  

_Ron Adam





More information about the Python-list mailing list