Message101967
You can't register an old-style class, but many ABCs support duck-typing by implementing __subclasshook__. ABCMeta caches those results and stores a reference to old-style classes, sometimes in _abc_cache and sometimes in _abc_negative_cache. It can't simply return False.
I guess that leaves two options:
1) Make old-style classes weak-referenceable and cache the results of __subclasshook__.
2) Refuse to cache old-style classes and call __subclasshook__ every time for old-style classes.
Python 2.7a4+ (trunk:79493, Mar 30 2010, 19:19:13)
>>> class old_iterable_class:
... def __iter__(self):
... pass
...
>>> import collections
>>> issubclass(old_iterable_class, collections.Iterable)
True |
|
| Date |
User |
Action |
Args |
| 2010-03-31 00:36:35 | stutzbach | set | recipients:
+ stutzbach, amaury.forgeotdarc, pitrou, ajaksu2, benjamin.peterson, flox |
| 2010-03-31 00:36:35 | stutzbach | set | messageid: <[email protected]> |
| 2010-03-31 00:36:34 | stutzbach | link | issue2521 messages |
| 2010-03-31 00:36:33 | stutzbach | create | |
|