Message191615
| 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:49 | rhettinger | set | recipients:
+ rhettinger, brett.cannon, pitrou, benjamin.peterson |
| 2013年06月21日 22:22:49 | rhettinger | set | messageid: <1371853369.59.0.358455846241.issue18275@psf.upfronthosting.co.za> |
| 2013年06月21日 22:22:49 | rhettinger | link | issue18275 messages |
| 2013年06月21日 22:22:49 | rhettinger | create |
|