On Apr 21, 2:25 am, rahul <rahul03...@gmail.com> wrote: > i have a c extension snip > dict=PyEval_GetLocals(); snip > PyMapping_SetItemString(dict,varname,newVar_pyvalue); snip
> than first two test cases runs correctly and gives result for var1 > "value changed" but 3rd test case not gives correct result and value > of var1 remains "abcd" > > why this happen and how i correct it ?? There's no good way to change the variable space programmatically. Python has more flexibility than most other languages as it is. Anyway, your best bet is to use an independent namespace: class Globals: pass setattr( Globals, 'itemX', 'value1' ) setattr( Globals, 'itemX', 'value2' ) Your 'updateCheck' function would then have to take the namespace as an additional parameter. -- http://mail.python.org/mailman/listinfo/python-list