This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients benjamin.peterson, brett.cannon, pitrou, rhettinger
Date 2013-06-21.22:22:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1371853369.59.0.358455846241.issue18275@psf.upfronthosting.co.za>
In-reply-to
Content
> 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)
History
Date User Action Args
2013-06-21 22:22:49rhettingersetrecipients: + rhettinger, brett.cannon, pitrou, benjamin.peterson
2013-06-21 22:22:49rhettingersetmessageid: <1371853369.59.0.358455846241.issue18275@psf.upfronthosting.co.za>
2013-06-21 22:22:49rhettingerlinkissue18275 messages
2013-06-21 22:22:49rhettingercreate