T
Terry Hancock
Could you elaborate on that please?
It would indeed be better to have a keyword for querying whether
a class or object *implements* a given *interface*. Which is essentially
what "duck typing" does, albeit somewhat haphazardly. The formal
alternative, of using interfaces is provided by external packages
such as Zope and PyProtocols, but has never been standardized and
adopted into the standard library. Perhaps it should be.
Certainly as long as there is more than one implementation of
interfaces, support for testing them cannot be at the keyword
level and remains through functions and methods. This is actually
pretty easy to use, though.
Giving isinstance() a keyword status as "isa" would encourage
bad style, though, as it would attract beginners away from much
better styles such as component/interface design.
While that wouldn't necessarily be sufficient reason to *remove*
an "isa" keyword if one existed, it certainly detracts from the
desire to add one.