Daniel Stutzbach <dan...@stutzbachenterprises.com> added the comment:

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

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue2521>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to