#1
  1. No Profile Picture
    inexperienced and useless
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2001
    Location
    Stevenage, uk
    Posts
    10
    Rep Power
    0

    how do I scoop variables??


    I'm currently using python to write a cgi script, I was wondering how I go about using a variable defined in one function outside of that function, without having to define it as a global variable.

    I've heared something about 'variable scooping' as being a way around this, can anyone give me a bit of info about how to do this?

    Thanks
  2. #2
  3. No Profile Picture
    Python Prophet
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2001
    Location
    Amersfoort, The Netherlands
    Posts
    45
    Rep Power
    13
    variable scope is just the 'scope' in which the variables work. For example, a variable defined in a function won't work in the global namespace. If you want to use it in another function, I think the best is to just pass that variable to the other function.
    Some people, when confronted with a problem, think I know, I'll use regular expressions. Now they have two problems. - Jamie Zawinski, in comp.lang.emacs

IMN logo majestic logo threadwatch logo seochat tools logo