OO in Python? ^^
Magnus Lycka
lycka at carmen.se
Wed Dec 14 12:03:02 EST 2005
Christopher Subich wrote:
> 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.
Correct, but he's just trolling you know. What he suggests isn't
static typing, and he knows it. It gives all the rigidity of static
typing with only a tiny fraction of the claimed benefits, but it would
give a hefty performance penalty.
More information about the Python-list
mailing list