Eric Promislow <er...@activestate.com> added the comment: I'm working on a debugger, trying to identify instances of old-style classes in Python 2, and any class in Python 3. The getattr formulation will work, but because I already need to maintain an "is_v3" flag, I might as well use it here.
As a side note, how are instances of new-style classes in v2 categorized? This v2 code prints 'None': import types def get_type_name(target_type): for t in dir(types): if target_type == getattr(types, t): return t class C(object): pass c = C() print get_type_name(type(c)) ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue8206> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com