On Tue, Oct 28, 2014 at 10:22 PM, Rustom Mody <[email protected]> wrote:
> How to see that list and range are both sequences?
> Or more generally how to to introspectively discover (ie not by reading
> docs!!)
> the abstract base classes -- eg sequence, iterable etc -- for an arbitrary
> object?
# Python 2/3 compatible. Combine with pprint for nice interactive output
try:
from collections import abc
except ImportError:
import collections as abc
def get_abc_map(cls):
return {n: issubclass(cls, getattr(abc, n)) for n in dir(abc) if
n[0].isupper()}
--
Zach
--
https://mail.python.org/mailman/listinfo/python-list