[Pyrex] Re: C-methods in extension types

Lenard Lindstrom len-l at telus.net
Tue Feb 21 18:33:56 CET 2006


Or just call est_mtdb_get_doc directly from within __new__. If there 
is more than one way to set the doc attribute then factory functions 
can be used:

def DocumentFromId(int id):
    cdef Document d
    d = Document()
    d.doc = est_mtdb_get_doc(id)
    return d

Lenard Lindstrom
<len-l at telus.net>


On 21 Feb 2006 at 16:44, Toby wrote:

> Helmut Jarausch wrote:
> > I want to call est_mtdb_get_doc and create a new instance of Document
> > where 'doc' holds the return value of est_mtdb_get_doc
> 
> Can't you just wrap the call to est_mtdb_get_doc in a cdef method, and
> call that method from within the (non cdef) __new__?
> 
> (I'm a newbie, so I might be saying something stupid.)
> 




More information about the Pyrex mailing list