New-style classes and special methods

2007-05-30 Thread Raj B
Hi My question is about how special methods are stored internally in Python objects. Consider a new-style class which implements special methods such as __call__ and __new__ class C(type): def __call__(...): class B: __metaclass__ = C b= B() The ty

Re: New-style classes and special methods

2007-05-30 Thread Raj B
> Yes, special methods populate the slots in the structures which Python > uses to represent types. Objects/typeobject.c in the Python source > distribution does the hard work, particularly in function type_new Thanks for that quick response. I am quite comfortable with C code and am try

Representation of new-style instance

2007-08-01 Thread 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 'rabb