setting variables in outer functions

brad byte8bits at
Mon Oct 29 21:59:10 CET 2007

Tommy Nordgren wrote:
> Given the following:
> def outer(arg)
>      avar = ''
>      def inner1(arg2)
>           # How can I set 'avar' here ?

Try this... works for me... maybe not for you?

def outer(avar=False):
     print avar
     if avar == True:

     def inner(avar=True):
         print avar
         return avar



More information about the Python-list mailing list