[Python-3000] ABC's, Roles, etc (original) (raw)
Guido van Rossum guido at python.org
Sun May 13 05:59:18 CEST 2007
- Previous message: [Python-3000] ABC's, Roles, etc
- Next message: [Python-3000] Octal literals anecdote
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 5/12/07, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
Guido van Rossum wrote:
> From this point, issubclass(InstrumentedList, Sequence) will be true > (and likewise for instances of it and isinstance(x, Sequence)). But > InstrumentedList's mro and bases are unchanged. I think I've figured out what bothers me about this kind of overloading of isinstance(). Normally if isinstance(x, C) is true, we expect that a method call on x can at least potentially invoke a method of class C. But if isinstance(x, C) can be true even if C doesn't appear in the mro of x, this is no longer the case.
Well, not if x.class overrides all of C's methods. And this registration business we're supposed to register only classes that provide concrete implementation of all of C's methods, which comes down to the same thing.
Also, I'm unclear under what circumstances knowing that would make a difference in your understanding of a program?
-- --Guido van Rossum (home page: http://www.python.org/~guido/)
- Previous message: [Python-3000] ABC's, Roles, etc
- Next message: [Python-3000] Octal literals anecdote
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]