type, object hierarchy?

S

Steve Holden

Christian said:
No, type is the meta class of the class object:

True

As you can see object is not a subclass of type but an instance of type.
This may look confusing at first but it's easy to explain. Like a class
is the blue print of an instance, a meta class is the blue print of a
class. In Python everything is a direct or indirect instance of type.
This might be helpful is the phrase "indirect instance" had any meaning
whatseover ;-)
o = someobject
while o is not type:
o = type(o)
print o

The code will eventually print "type".
Except, of course, when someobject is type, when it won't print anything
at all.

regards
Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top