This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ericp
Recipients ericp, loewis
Date 2010-03-22.23:38:02
SpamBayes Score 0.0001573044
Marked as misclassified No
Message-id <1269301083.71.0.810116535759.issue8206@psf.upfronthosting.co.za>
In-reply-to
Content
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))
History
Date User Action Args
2010-03-22 23:38:03ericpsetrecipients: + ericp, loewis
2010-03-22 23:38:03ericpsetmessageid: <1269301083.71.0.810116535759.issue8206@psf.upfronthosting.co.za>
2010-03-22 23:38:02ericplinkissue8206 messages
2010-03-22 23:38:02ericpcreate