Patches item #1708353, was opened at 2007-04-26 16:16
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1708353&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Core (C code)
Group: Python 3000
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Guido van Rossum (gvanrossum)
Assigned to: Guido van Rossum (gvanrossum)
Summary: Make isinstance/issubclass overloadable

Initial Comment:
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).


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1708353&group_id=5470
_______________________________________________
Patches mailing list
[email protected]
http://mail.python.org/mailman/listinfo/patches

Reply via email to