[issue18275] Make isinstance() work with super type instances

2020-03-06 Thread Brett Cannon
Brett Cannon added the comment: After 6 years and no really movement I don't think we are going to bother to change the semantics for this. :) -- resolution: -> wont fix stage: test needed -> resolved status: open -> closed ___ Python tracker

[issue18275] Make isinstance() work with super type instances

2013-06-22 Thread Arfrever Frehtes Taifersar Arahesis
Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com: -- nosy: +Arfrever ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18275 ___

[issue18275] Make isinstance() work with super type instances

2013-06-21 Thread Antoine Pitrou
Antoine Pitrou added the comment: Does anyone actually check for instance-ness of super objects? I would never have thought of such an idiom. -- nosy: +benjamin.peterson, pitrou ___ Python tracker rep...@bugs.python.org

[issue18275] Make isinstance() work with super type instances

2013-06-21 Thread Brett Cannon
Brett Cannon added the comment: So I have a use case for this actually. =) http://bugs.python.org/issue17621 is about trying to finally add a lazy mixin to importlib so people stop asking for it. I have a version already written externally at

[issue18275] Make isinstance() work with super type instances

2013-06-21 Thread Antoine Pitrou
Antoine Pitrou added the comment: http://bugs.python.org/issue17621 is about trying to finally add a lazy mixin to importlib so people stop asking for it. I have a version already written externally at https://code.google.com/p/importers/source/browse/importers/lazy.py. Part of the trick of

[issue18275] Make isinstance() work with super type instances

2013-06-21 Thread Brett Cannon
Brett Cannon added the comment: On Fri, Jun 21, 2013 at 10:02 AM, Antoine Pitrou rep...@bugs.python.orgwrote: Antoine Pitrou added the comment: http://bugs.python.org/issue17621 is about trying to finally add a lazy mixin to importlib so people stop asking for it. I have a version

[issue18275] Make isinstance() work with super type instances

2013-06-21 Thread Antoine Pitrou
Antoine Pitrou added the comment: I'm attracted to the idea of making a loader lazy by simply doing something like ``class LazySourceFileLoader(LazyMixin, SourceFileLoader): ...``. But then you have to make a specific Lazy subclass for each delegated loader implementation. With a proxy

[issue18275] Make isinstance() work with super type instances

2013-06-21 Thread Brett Cannon
Brett Cannon added the comment: On Fri, Jun 21, 2013 at 11:11 AM, Antoine Pitrou rep...@bugs.python.orgwrote: Antoine Pitrou added the comment: I'm attracted to the idea of making a loader lazy by simply doing something like ``class LazySourceFileLoader(LazyMixin, SourceFileLoader):

[issue18275] Make isinstance() work with super type instances

2013-06-21 Thread Raymond Hettinger
Raymond Hettinger added the comment: I'm not sure this is a theoretically sound idea. Do you know what CLOS does in the same circumstance? -- nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18275

[issue18275] Make isinstance() work with super type instances

2013-06-21 Thread Brett Cannon
Brett Cannon added the comment: I have no idea what CLOS does in this situation. I'm fine with this never being changed, but I wanted to at least file the bug to have the discussion in case it ever comes up again. -- ___ Python tracker

[issue18275] Make isinstance() work with super type instances

2013-06-21 Thread Raymond Hettinger
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

[issue18275] Make isinstance() work with super type instances

2013-06-21 Thread Brett Cannon
Brett Cannon added the comment: That solution looks right. Problem is that it would need to either go directly into isinstance() or type would need to grow an __instancecheck__ to deal with this case since you can't override isinstance from the instance end. That I'm not sure people are okay

[issue18275] Make isinstance() work with super type instances

2013-06-20 Thread Brett Cannon
New submission from Brett Cannon: class A: pass class B(A): pass sup = super(B, B()) isinstance(sup, A) # returns False Why is that? Is there an explicit reason to prevent that isinstance check from working? How about just for ABCs? Either way it's annoying that at least for ABCs you can't