Antoon Pardon wrote: > Suppose we would add type declarations in python. > So we could do things like > > int: a > object: b > > Some people seem to think that this would introduce static > typing, but the only effect those staments need to have > is that each time a variable is rebound an assert statement > would implicitly be executed, checking whether the variable is > still an instance of the declared type.
Doesn't work; duck typing is emphatically not subclass-typing. For this system to still work and be as general as Python is now (without having to make all variables 'object's), we'd need true interface checking. That is, we'd have to be able to say: implements + like int: a or somesuch. This is a Hard problem, and not worth solving for the simple benefit of checking type errors in code. It might be worth solving for dynamic code optimization, but that's still a ways off. -- http://mail.python.org/mailman/listinfo/python-list