Representation of new-style instance

R

Raj B

Consider a new-style class

class rabbit(object):
def __init__(self,c):
self.color = c

r1=rabbit("blue")
r2=rabbit("purple")

Which C struct in the Python implementation is used to represent the
instances c1 and c2 of the
new-style class? I understand that when the class 'rabbit' is
created, the type_new function
in typeobject.c creates a copy of a 'struct typeobject' with
dictionary tp_dict appropriately modified.

However, I can't figure out which structure is used for new-style
instances and where the instance dictionary is stored. Could anyone
please clarify?

Thanks
Raj
 
B

Bjoern Schliessmann

Raj said:
Which C struct in the Python implementation is used to represent
the instances c1 and c2 of the new-style class?

You don't try to send this raw over some stream connection, do you?

Regards,


Björn
 

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,770
Messages
2,569,583
Members
45,072
Latest member
trafficcone

Latest Threads

Top