variable update

Fredrik Lundh fredrik at pythonware.com
Tue Sep 12 18:05:43 CEST 2006


Steve Holden wrote:

>> access it, and catch the NameError:
>>
>>     try:
>>         variable
>>     except NameError:
> 
> In a function when accessing a not-yet-bound local variable you may also 
> (as Fredrik knows but didn't bother to say) see an UnboundLocalError 
> exception,

 >>> issubclass(UnboundLocalError, NameError)
True

 >>> # muhaha!

</F>




More information about the Python-list mailing list