[Python-Dev] Small misleadingness in docs (original) (raw)
Terry Reedy tjreedy at udel.edu
Sat Feb 14 18🔞27 CET 2009
- Previous message: [Python-Dev] Small misleadingness in docs
- Next message: [Python-Dev] Small misleadingness in docs
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Greg Ewing wrote:
Georg Brandl wrote:
Since I cannot imagine a scenario where you would want to have non-classes as the arguments of issubclass(), I had one today, which is what led me to discover this. I'm working on a Python-Ruby bridge that wraps Ruby objects and classes in Python objects. I wanted to make isinstance() and issubclass() work in the expected way when applied to wrappers around Ruby classes. The ability to fake things using classes and bases turned out to be very handy.
The new (in 3.0 and maybe 2.6, but undocumented) special methods instancecheck and subclasscheck let one overload the default behavior of isinstance and issubclass. So there is no reason to have the default behavior necessarily cover 'unusual' cases. See http://www.python.org/dev/peps/pep-3119/#overloading-isinstance-and-issubclass and http://bugs.python.org/issue5250.
- Previous message: [Python-Dev] Small misleadingness in docs
- Next message: [Python-Dev] Small misleadingness in docs
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]