exec behaviour; Functions as instance members.
Michel NIZETTE
mnizette at ulb.ac.be
Mon Oct 18 06:54:19 EDT 1999
Hello,
Two questions from a beginner :
1) Inside a function definition why doesn't
exec "global i"
exec "i = 1"
set the global variable i to 1, although
exec "global i\ni = 1"
does ?
2) To define a function as a member of a class instance, is there a
shorter way than introducing a temporary function name as in the
following ?
def Temp():
# Code...
ClassInst.Func = Temp
del Temp
Thanks !
More information about the Python-list
mailing list