Accessing "variables" in an extension module

Christian Wermuth christian at
Wed Dec 6 09:19:45 EST 2000

I would like to access "variables" (chars and ints) in a C module
extension for Python from my Python code. Is that possible?
If I wanted to improve the example from "Extending and Embedding the
Python Interpreter" like shown below, what would I need to add to the
spam.c code?

import spam
spam.varstring = "test"
spam.varint = 5
spam.system('dir c:')

Thanks in advance,
Christian Wermuth

More information about the Python-list mailing list