Embedding help

Gustavo Niemeyer niemeyer at conectiva.com
Sun Mar 24 14:52:46 EST 2002


> (called once)  setup(int type)
> This would initialize python and a python class with the passed-in value 
> (Used internally by the python class).
> This python class would also import other modules (both builtin and 
> custom; the custom ones would be pure python)
[...]
> My problem is the following:
> How do I keep the class instance around so that I can maintain state? 
> The getPt function would return variables that in part are functions of 
> previous inputs, not just the current input.

I'm not sure I could follow you here.

State is maintained internaly by the python interpreter. Just don't
reinitialize the interpreter between calls to your functions. If you
want to save your instaces for further usage, just save them in
static variables or lists, as you'd usually do.

-- 
Gustavo Niemeyer

[ 2AAC 7928 0FBF 0299 5EB5  60E2 2253 B29A 6664 3A0C ]




More information about the Python-list mailing list