[C++-sig] python callback - can it be stateful?

David Abrahams dave at boost-consulting.com
Thu May 19 15:07:35 CEST 2005


apocalypznow <apocalypznow at gmail.com> writes:

> Is there a way to have C++ call a Python callback, but have that Python 
> callback operate on global python variables that have kept their state 
> from previous callbacks?

I don't understand the question.  If the Python interpreter is still
running (PyInitialize has been called and PyFinalize hasn't), any
"global" Python variables (attributes of a Python module) remain
unchanged.

> Another similar question: can a Python callback set a global variable 
> while another Python callback get the state of that variable?

This question is similarly confusing.

FWIW, neither of these questions has anything specific to do with
integrating Python and C++; you might want to try asking on
comp.lang.python.

Cheers,
-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com




More information about the Cplusplus-sig mailing list