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

Matt mjkeyes at sbcglobal.net
Mon Dec 5 07:02:13 CET 2005


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?

Thanks! Matt



More information about the Cplusplus-sig mailing list