Simple question about variables

Wojtek Walczak gminick at hacker.pl
Sun Dec 1 06:46:56 EST 2002


Dnia Sun, 1 Dec 2002 09:27:11 +0100, Michel COMBE napisał(a):
> I would like the 3 phases to be 3 procedures.
> How can I manage to have the record set declared globally so that I can use
> it from all 3 procedures ?
> (Right now, it is declared locally in the first procedure by the statement
> result=cursor.fetchall )
I'm not sure what are you trying to achieve, but I think 'global'
could be the answet to your question.

result = None

def procedure_one():
   global result
   ...

def procedure_two():
   global result
   ...

def procedure_three():
   global result
   ...

Now result is the same variable in all the procedures.
Is that what you wanted ?

-- 
[ ] gminick (at) underground.org.pl  http://gminick.linuxsecurity.pl/ [ ]
[ "Po prostu lubie poranna samotnosc, bo wtedy kawa smakuje najlepiej." ]



More information about the Python-list mailing list