[Pyrex] Question about object creation

Martin Sjögren msjogren at gmail.com
Sun Aug 15 13:29:34 CEST 2004


On Fri, 13 Aug 2004 13:05:14 +1200, Greg Ewing
<greg at cosc.canterbury.ac.nz> wrote:
> You can have a factory function that creates an object and then
> assigns things to its C attributes to finish initialising it. The
> factory function will have to create the basic object by calling its
> type object, the same way as in Python.
> 
> One tricky thing you'll need to keep in mind is that Python code will
> be able to instantiate the object directly as well, without going
> through your factory functions. So you'll need to make sure something
> reasonable happens in that case.
> 
> Does that answer your question?

Yes, from what you're saying it seems like I won't be able to do what
I want, but this has little (probably nothing) to do with pyrex, and
everything to do with how the new-style types work.

It just seems such a waste to have to create a dummy X509_NAME value
in __new__ (or __init__) just to free and overwrite it later. Oh well.
:) Thanks for the help.


/Martin




More information about the Pyrex mailing list