[Pyrex] Cannot cdef __init__?

Phillip J. Eby pje at telecommunity.com
Sun Jan 18 05:14:35 CET 2004


At 02:44 PM 1/18/04 +1100, Andrew Bennetts wrote:
>Is there some way to initialise a class with a c variable that I don't know
>about?  Or am I misunderstanding something more fundamental?

Think about it this way:  if you wrote the following:

from yourExample import Fred

f = Fred("a pair")

what would happen?

In other words, you're creating a type that can be invoked from 
Python.  Therefore, its parameters *must* be objects.  Period.

If you need a way to create the object from *C* code, then you should 
create a factory function that creates a Fred and then sets its p to a 
valid value.





More information about the Pyrex mailing list