Equivalent to c++ typeof(x)

Andrew Wilkinson ajw126 at student.cs.york.ac.uk
Wed Jan 9 11:14:35 EST 2002


Hi,

Is there any equivalent in Python to the C++ construct

typeof(<instance variable>) == typeof(<class>)

The Python type(<variable>) returns 'instance' for any class, however I 
need to know the extact type of class. So for example...

class a:
     pass

class b:
     pass

x = a()
y = b()

type(x) == type(y)  # I'd like this line to return false but it returns 
true!

Any suggestions?
Andrew




More information about the Python-list mailing list