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

ben at co.and.co ben at co.and.co
Sun May 21 06:19:55 EDT 2000


[ Lots of things about case-sensitivity and readability already said ]

I don't know about alice, but I think the quest for case-insensivity is
masking the problem at hand:

class Employee:
    def __init__(self, salary=0):
        self.Salary = salary
    def set_salary(self, salary):
        self.salary = salary

The problem is: there's no way to check a python program without running
it, and without variable declarations there's no way to catch errors
like these. Case-insensitivity is not going to help:

    def set_salary(self, salary):
        self.Salyry = salary

Right now, the topic of variable declarations is thightly coupled with
Statical Typing, but it doesn't need to. The second is build on the
foundations of the former:

    def __init__(self, salary=0):
        decl self.salary = salary
and
    def __init__(self, integer salary=0):
        decl integer self.salary = salary
        
If variable declarations would exist, it would be trivial to make Idle
say 'Ni' whenever you make a spelling mistake (not limited to
mistakes against case), because it knows all variables. It would also
catch some unwanted reuse of variables.

Side notes:
 o  Types: I've seen a few proposals for a (bla: integer) syntax.
    This makes no sense if you want initialising too. Compare:
    def f(bla=0: integer):
    def f(bla: integer=0):
    def f(integer bla=0):
 o  A 'with'-keyword would be handy from time to time:
    with self:
        decl .salary = salary
        decl .name = ''
        decl .age = 0
 o  My school doesn't want to consider Python for teaching without typed
    variables (right now the're using Oberon). So hurry up, Types-SIG!

Greetings,
-- 
ben . de . rydt at pandora . be ------------------ your comments
http://users.pandora.be/bdr/ ------- inl. IPv6, Linux en Pandora




More information about the Python-list mailing list