where is upvar

Jake Baker jbaker at ummelec.com
Thu Sep 21 10:34:25 EDT 2000


First, I should note something from the Python docs:

" locals () 
Return a dictionary representing the current local symbol table. Warning: the contents of this dictionary should not be modified; changes may not affect the values of local variables used by the interpreter. "

In the tests I tried, I could not change the value of a local variable by changing locals().

> My entrance into the world of python was to write a command line
> parser ala http://wsd.iitb.fhg.de/~kir/clighome/. It is quite natural
> to let the parser set variables directly in the calling stack frame,
> normally the __main__ of the script.

Ok. So if I read you correctly, what you want to do is have a utility like clig (or to extend clig) to output cl parsers for Python. Since I don't have a postscript reader handy, I can't read what the resulting C function looks like, but I'm supposing it passes pointers to the variables.

In Python, have the created parse function return a dictionary whose keys are the cl args.

(An alternative would be to require the user pass the function class-wrapped variables, although I would prefer the first method.)

Yours,
 - Jake




More information about the Python-list mailing list