[Pyrex] FAQ contribution (fwd)
Greg Ewing
greg at cosc.canterbury.ac.nz
Wed Jul 23 07:53:53 CEST 2003
John J Lee <jjl at pobox.com>:
> cdef MyExtensionType foo():
> return MyExtensionType()
>
> cdef class AnotherExtType:
> ...
> def blah(self):
> met = foo()
> foo.attr # Pyrex complains at runtime
That makes no sense. Maybe you meant
met.attr
in which case you seem to be expecting Pyrex to do type inference.
It doesn't. You need to say
def blah(self):
cdef MyExtensionType met
met = foo()
# met.attr will now be understood
Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury, | A citizen of NewZealandCorp, a |
Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. |
greg at cosc.canterbury.ac.nz +--------------------------------------+
More information about the Pyrex
mailing list