Simple question about variables

John Hunter jdhunter at ace.bsd.uchicago.edu
Sun Dec 1 10:20:55 EST 2002


>>>>> "Michel" == Michel COMBE <michel.l.combe at free.fr> writes:

    Michel> I would like the 3 phases to be 3 procedures.  How can I
    Michel> manage to have the record set declared globally so that I
    Michel> can use it from all 3 procedures ?  (Right now, it is
    Michel> declared locally in the first procedure by the statement
    Michel> result=cursor.fetchall )

You could also wrap the 3 procedures in a class and use attributes to
share data

class myclass:

  def __init__(self):
    self._var = None

  def proc1(self):
    self._var = do_something

  def proc2(self):
    do_something_else_with self._var

  




More information about the Python-list mailing list