scope
Navid Parvini
parvini_navid at yahoo.com
Sun Feb 3 08:04:14 EST 2008
Dear All,
I have the following two methods in a module. I cannot put them in a class, as the code is a complicated one.
def a(num):
found = num in Numlist
print found
def b():
scop = {}
scop['Numlist'] = [1,2,3]
scop['a'] = a
exec("a(3)",scop)
How can I access the "Numlist" inside the method a, without using classes or defining Numlist as GLOBAL? I prefer using scops in this problem. Is there a way?
Thank you very much,
Navid
---------------------------------
Looking for last minute shopping deals? Find them fast with Yahoo! Search.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080203/f87ac56e/attachment.html>
More information about the Python-list
mailing list