This previous proposal was kinda brain dead, as it
requires the introduction of a "interface" type
which is "not pythonic".
However, I was wondering. Assume the following:
a) Add a __queryinterface__ slot (in lieu of a __iter__ slot)
b) __queryinterface__ a string which uniquely identifies the
interface and returns an object which implements the interface
(what is an interface is left vague) or an InterfaceUnknown
c) Revise the iterator proposal, so that all calls to
is replaced with
d) Revise the iterator proposal, so that implementsion of
__iter__ change from:
if interface = "org.python.iterator": return self
If we are going to add a slot to support "iterator interfaces",
why not make it generic to support any type of interface?
P.S. This does not change the semantics of the
__iter__ proposal much at all...