OO in Python? ^^
Antoon Pardon
apardon at forel.vub.ac.be
Thu Dec 15 03:21:50 EST 2005
Op 2005-12-14, Christopher Subich schreef <csubich.spam.block at spam.subich.block.com>:
> 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.
I don't see how that is relevant.
> For this
> system to still work and be as general as Python is now (without having
> to make all variables 'object's),
But the way Guido wants python to evolve would make all variables
objects. This is what PEP 3000 states.
Support only new-style classes; classic classes will be gone.
As far as I understand this would imply that all classes are subclasses
of object and thus that isinstance(var, object) would be true for all variables.
--
Antoon Pardon
More information about the Python-list
mailing list