On Mon, 17 Sep 2007 17:49:58 +0100
Paul Rudin <[EMAIL PROTECTED]> wrote:

> Stefano Esposito <[EMAIL PROTECTED]> writes:
> 
> > Hi all
> >
> > what i'm trying to do is this:
> >
> >>>>def foo ():
> > ... return None
> > ...
> >>>>def bar ():
> > ... print "called bar"
> > ...
> >>>>def assigner ():
> > ... foo = bar
> > ...
> >>>>assigner()
> >>>>foo()
> > called bar
> >>>>
> >
> > This piece of code is not working and even trying with...
> 
> 
> > ... How can I achieve my goal?
> 
> 
> By adding the line:
>    global foo
> at the beginning of the body of assigner.
> 

This worked, thanks a lot :)


-- 
Stefano Esposito <[EMAIL PROTECTED]>
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to