[Python-3000] ABC's, Roles, etc (original) (raw)
Greg Ewing greg.ewing at canterbury.ac.nz
Sun May 13 03:40:11 CEST 2007
- Previous message: [Python-3000] ABC's, Roles, etc
- Next message: [Python-3000] ABC's, Roles, etc
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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.
This isn't so much of a worry when x is acting as a proxy for C, since it's probably forwarding method calls to a real instance of C somewhere. But using it in a more general way seems strange.
-- Greg
- Previous message: [Python-3000] ABC's, Roles, etc
- Next message: [Python-3000] ABC's, Roles, etc
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]