[Pyrex] Special Methods of Extension Types: inheritance

Simon Burton simon at arrowtheory.com
Wed Aug 3 04:19:42 CEST 2005


On Wed, 03 Aug 2005 14:25:28 +1200
Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:

> 
> > 1) The special methods __new__ and __dealloc__ are chained to
>  > the superclass (good)
> > 
> > 2) other methods ( __int__ and i'm not sure what else ) are not
>  > inherited (why not?)
> 
> Generally I've tried to make things behave like their
> Python counterparts as much as possible, which means
> usually not calling superclass methods automatically.

The python counterpart to __int__ is inherited:

>>> class A:
...   def __int__(self): return 1
...
>>>
>>> class B(A):
...   pass
...
>>> a=A()
>>> int(a)
1
>>> b=B()
>>> int(b)
1


But, as far as i can tell, this is not how the Pyrex __int__ works.

Simon.

-- 
Simon Burton, B.Sc.
Licensed PO Box 8066
ANU Canberra 2601
Australia
Ph. 61 02 6249 6940
http://arrowtheory.com 



More information about the Pyrex mailing list