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

Tim Rowe digitig at cix.co.uk
Tue Jun 6 18:20:00 EDT 2000


In article <393CCEE6.E5C1C267 at marconicomms.com>, 
Wolfgang.Grafen at marconicomms.com (Wolfgang Grafen) wrote:

> b) case-sensitivity with the awareness of same names. Just allow
> 
> >>> Orange = 1
> >>> Orange = 2
> 
> but throw an exception when
> >>> orange = 3
> or
> >>> ORANGE = 4 etc.

I consider that bad behaviour. I have said elsewhere that there are 
programming idioms I consider to be good practice that use case to 
distinguish objects. I'd have no objection to an editor that pointed out 
to me when I was doing it, but I would consider exceptions to be a serious 
penalty for no real advantage. Are we going to make C/C++ 
and Java case-insensitive, too? Or are these learners going to have to 
come to terms with the fact that "a" <> "A" at some point, and the sooner 
the better?

> a more difficult task is to recognize spelling mistakes:
> >>> ornge = 2
> >>> oragne =3
> >>> orange_colour = "orange"

The trouble with that is, having been forbidden the use of canvas after a 
from Tkinter import * (clashes with "Canvas"), now the confounded thing is 
going to assume aCanvas is a typo, amend it to Canvas and throw it out! 
We'd end up with /much/ too restricted a set of identifiers. As a Brit I 
have enough trouble with color/colour, but I emphatically do /not/ want 
the compiler to tell me I can't use my native spelling of "colour".

"Corrected in place" is a disaster in waiting, by the way. Did anyone here 
ever use Comal? That "corrected" typo's in place, but as it didn't know 
what the programmer intended it basically changed to random code. The 
result was that it replaced error messages with hard-to-find bugs.

> When programming or reading the input of a non-experienced programmer
> who might think  012 is decimal 12 the input will be interpreted as
> an octal number. I don't have any solution for this. Maybe there should 
> be
> a routine reading from stdin which doesn't interpret 012 as octal 
> number...

A Python-aware editor can help with this. I set my C++ editor to highlight 
octal in a different colour to decimal, which makes it easy to spot.



More information about the Python-list mailing list