[Pyrex] C methods in extension types

Andreas Kostyrka andreas at mtg.co.at
Wed Oct 8 22:11:52 CEST 2003


Am Mi, den 08.10.2003 schrieb Francesc Alted um 22:00:
> A Dimecres 08 Octubre 2003 21:05, Andreas Kostyrka va escriure:
> >
> > def __next__(self):
> >     cdef Table mytab
> >     mytab = self._table
> >     self.recout = mytab._read_records(self.nrowsread, ...)
> >
> > How's that?
> 
> That works just fine... but why?
That's easy.
Pyrex doesn't know that self._table is Table object ->
So it runs basically:
getattr(self._table,"_read_records")(...)
When you assign it to the typified variable, it can directly access the
C variables/methods.

It should be enough also if you would change
cdef object _table
to
cdef Table _table

Andreas

> 
> Thanks!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
Url : http://lists.copyleft.no/pipermail/pyrex/attachments/20031008/dcb47e0d/attachment.bin


More information about the Pyrex mailing list