Raymond Hettinger added the comment:
> I have no idea what CLOS does in this situation.
No worries, I was just curious whether you knew whether this was a solved
problem in Dylan or CLOS or some other language.
When faced with a diamond diagram, what are the semantics for
isinstance(super_instance, cls)?
I worked on it for a little bit and came up with the following:
def super_isinstance(super_inst, cls):
'Is the cls in the mro somewhere after the current class?'
mro = super_inst.__self__.__class__.__mro__
thisclass = super_inst.__thisclass__
return cls in mro and mro.index(thisclass) < mro.index(cls)
----------
Added file: http://bugs.python.org/file30663/simple_diamond_example.py
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue18275>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com