Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.python
Re: scope
Guilherme Polo
2/3/2008 1:21:00 PM
2008/2/3, Navid Parvini <parvini_navid@yahoo.com>:
> 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,
a is a function, not a method.
> without using classes or
> defining Numlist as GLOBAL? I prefer using scops in this problem. Is there a
> way?
Pass it as argument to function a
>
> Thank you very much,
> Navid
>
>
> ________________________________
> Looking for last minute shopping deals? Find them fast with Yahoo! Search.
>
>
> --
>
http://mail.python.org/mailman/listinfo/p...
>
--
-- Guilherme H. Polo Goncalves
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Re: scope
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password