On 4/29/07, Steven Bethard
On 4/29/07, Talin
wrote: If it were technically possible, I would recommend that this PEP have to run the same gauntlet that any other large library addition would, which is to go through a long period of community feedback and criticism, during which a large number of people actually attempt to use the feature for real work.
This sounds like a pretty good reason to add __isinstance__() and __issubclass__(). Then the various ABCs can be distributed as third-party modules but can still make sure that things like isinstance(42, Real) and issubclass(int, Complex) are True (or whatever other assertions people want to make).
Or isexample, so that we aren't locked into implementing ABCs as base classes. def isexample(val, ABC): return ABC.__example__(val) class ABC(object): def __example__(cls, val): if val in cls.__instance: return True if val in cls.__non_instance: return False for instclass in type(val).__mro__: if instclass in __class: return True if instclass in __non_class: return False return False ... methods to register classes, unregister subclasses, etc -jJ