[C++-sig] Creating new instances of an object's contained value

Roman Yakovenko roman.yakovenko at gmail.com
Mon Dec 5 07:21:48 CET 2005


On 12/5/05, Matt <mjkeyes at sbcglobal.net> wrote:
> Hey all,
>
> This is probably a newbie question, but I'm curious if it's possible to
> create a new instance of an object's contained value into another object
> variable in an extension module I'm working on.
>
> For example, I am trying to create a factory method of sorts that will
> create a python object and return it.  Rather than load up the dictionary
> and module and call Py_RunString each time the method is called, I would
> like to only do this once (I'm not worried about reloading this python
> object after the extension module is loaded).  Thus, I was thinking of
> keeping an object variable that I can "clone", so to speak, and return the
> cloned value.  Is this possible?

It is not clear, what you are trying to do. After you load your module
you can keep
reference to it and to call what ever function you want.

> Thanks!
> Matt

Roman Yakovenko



More information about the Cplusplus-sig mailing list