[visionegg] Confused about variable scope

  • From: "Alex Wade" <wade@xxxxxxx>
  • To: visionegg@xxxxxxxxxxxxx
  • Date: Thu, 01 Apr 2004 21:45:44 -0800

I realise that this is probably more of a python thing than
a visionegg problem but...

I don't understand the way that variables scope is resolved
in, say, a controller function. Here, from the
image_sequence_fast.py example there's a bit of code that
reads:
.....

def put_image(t):
    i = int(t/duration_per_image) # choose image
    texture_object.put_sub_image( image_list[i] )
    
p.add_controller(None,None,FunctionController(during_go_func=put_image))
.....

Nothing has been declared as global. So how does
'put_image' know what, say, duration_per_image or
texture_object are? 

What am I missing? 

thanks in advance...
alex


A.R. Wade Ph.D. 
Associate Scientist
Brain Imaging Center
The Smith-Kettlewell Eye Research Institute
2318 Fillmore Street
San Francisco, CA 94115

======================================
The Vision Egg mailing list
Archives: //www.freelists.org/archives/visionegg
Website: http://www.visionegg.org/mailinglist.html

Other related posts: