setting variables in outer functions

brad byte8bits at gmail.com
Mon Oct 29 17:29:49 EDT 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