setting variables in outer functions

brad byte8bits at gmail.com
Mon Oct 29 22:29:49 CET 2007


Tommy Nordgren wrote:

>> def outer(avar=False):
>>      print avar
>>      if avar == True:
>>          return
>>
>>      def inner(avar=True):
>>          print avar
>>          return avar
>>
>>      outer(inner())
>>
>> outer()

>     This is not a general solution to this problem.

Run my example code, it works (if I'm understanding your question 
correctly). It sets outer to True... inner returns True to outer and 
thus the var is set... am I missing something?



More information about the Python-list mailing list