co_freevars question
Robert Brewer
fumanchu at amor.org
Tue Apr 20 12:54:49 EDT 2004
Playing around with func_code objects today, I typed:
>>> y = 3
>>> f = lambda x: x.Date == y
>>> f.func_code.co_freevars
()
I would have expected co_freevars to be ('y', ) rather like:
>>> [k for k in f.func_globals if k in f.func_code.co_names and k not in
f.func_code.co_varnames]
['y']
What am I misunderstanding? Under what circumstances does co_freevars
actually possess any items?
Robert Brewer
MIS
Amor Ministries
fumanchu at amor.org
More information about the Python-list
mailing list