OO in Python? ^^

Ben Sizer kylotan at gmail.com
Thu Dec 15 06:11:28 EST 2005


Antoon Pardon wrote:
> Op 2005-12-14, Christopher Subich schreef
> > 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.

But that's still useless for your purposes. Everything will be derived
from object but it doesn't mean everything file-like will be derived
from file or everything dictionary-like will be derived from
dictionary. Duck-typing means that code told to 'expect' certain types
will break unnecessarily when a different-yet-equivalent type is later
passed to it.

-- 
Ben Sizer




More information about the Python-list mailing list