variable update

Fredrik Lundh fredrik at pythonware.com
Tue Sep 12 12:05:43 EDT 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