This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gvanrossum
Date 2007-04-26.20:16:58
SpamBayes Score
Marked as misclassified
I came up with a fairly simple way to overload isinstance() and issubclass().  The class that is the second argument can define a (class) method named __instancecheck__ or __subclasscheck__ which, if present, will be called *instead* of the normal approach.

The names are different to remind users that the calling convention is the opposite -- isinstance(x, C) maps to C.__instancecheck__(x).
Date User Action Args
2007-08-23 15:58:15adminlinkissue1708353 messages
2007-08-23 15:58:15admincreate