Case Sensitive, Multiline Comments

Peter Hansen peter at engcorp.com
Thu May 26 23:06:27 EDT 2005


Elliot Temple wrote:
> Thanks for the link on case sensitivity.  I'm curious about the person
> who found case sensitivity useful though: what is it useful for?

I wasn't that person, but I do find case sensitivity very useful.

Mainly it's useful in that it allows me not to spend any time at all 
worrying that I just might have a collision in my naming of various 
entities that are conceptually in different spaces but which -- due to 
the nature of the language I'm using -- happen to co-exist in the same 
namespace.

For example, although this contrived example suggests poor imagination 
in picking names, I think it demonstrates the point.

INVENTORYCODE = 5   # in effect one item in a constant "enum"

class InventoryCode:
     '''Might represent something to do with inventory codes... duh'''


def myfunc():
     inventoryCode = someOtherFunction()


In other words, I have a CONSTANT, a Class, and an instance, and if the 
set of code involved were large enough, these three things might be 
defined far enough apart that the potential collision wouldn't be as 
obvious as it is here.

More to the point, there might not be any relationship between these 
things in my mind as I'm programming, and having to deal with an error 
message from a compiler or, worse, a run time error resulting from this 
collision would really annoy me.

Case sensitivity might not be something we should be deliberately 
exercising on a daily basis, but there's no good reason (in my opinion) 
for not having it available to allow one freedom in naming (assuming one 
is sane and uses consistent convention for the case of things like 
constants, classes, and instances) without the worry of pesky collisions.

-Peter



More information about the Python-list mailing list