OO in Python? ^^

Antoon Pardon apardon at forel.vub.ac.be
Thu Dec 15 03:31:02 EST 2005


Op 2005-12-14, Magnus Lycka schreef <lycka at carmen.se>:
> 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.

What I know or not isn't the point. My impression is that different
people have different ideas on what is static typing and what is not.
I can't read minds about what each individual person thinks. So
I don't know whether you (or someone else) considered this static
typing or not.

> 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.

Yes it would give a performance penalty. That is irrelavant to the
question asked. Nothing stops the language designers from using
this type information, to produce more efficient code where possible.
But whether or not the designers would do this, would make no difference
on what would be possible to do.

-- 
Antoon Pardon



More information about the Python-list mailing list