variable update

Steve Holden steve at holdenweb.com
Tue Sep 12 12:51:44 EDT 2006


Fredrik Lundh wrote:
> 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!
> 
Cool.

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd          http://www.holdenweb.com
Skype: holdenweb       http://holdenweb.blogspot.com
Recent Ramblings     http://del.icio.us/steve.holden




More information about the Python-list mailing list