homepage

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
Recipients
Date 2007年04月26日.20:16:58
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
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).
History
Date User Action Args
2007年08月23日 15:58:15adminlinkissue1708353 messages
2007年08月23日 15:58:15admincreate

AltStyle によって変換されたページ (->オリジナル) /