How to assign a function to another function
Stefano Esposito
stefano.esposito87 at gmail.com
Mon Sep 17 13:11:16 EDT 2007
More information about the Python-list mailing list
Mon Sep 17 13:11:16 EDT 2007
- Previous message (by thread): How to assign a function to another function
- Next message (by thread): Using python to create windows apps that everyone can use?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Mon, 17 Sep 2007 17:49:58 +0100 Paul Rudin <paul.nospam at rudin.co.uk> wrote: > Stefano Esposito <stefano.esposito87 at gmail.com> 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 <stefano.esposito87 at gmail.com>
- Previous message (by thread): How to assign a function to another function
- Next message (by thread): Using python to create windows apps that everyone can use?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list