[Pyrex] C versus Python access

Greg Ewing greg.ewing at canterbury.ac.nz
Wed Oct 31 23:37:10 CET 2007


Robert Bradshaw wrote:

> if type(self) has a __dict__:
>     foo = self.getattr('foo')
>     if foo is not wrapper_foo:
>         return foo(args)
> [cdef method body]

It does add an attribute lookup whenever a Python subclass
is involved, so it's not entirely overhead-free.

More seriously, it looks like it will fail if the overriding
method tries to call the inherited method. This will call
the wrapper, which will pick up the overriding method and
call it again, leading to infinite recursion.

--
Greg





More information about the Pyrex mailing list