[Python-Dev] more timely detection of unbound locals

Steven D'Aprano steve at pearwood.info
Wed May 11 00:38:53 CEST 2011


Nick Coghlan wrote:

> Personally, I would just add "in current scope" to the existing error
> message for the unbound local case (and potentially collapse the
> exception hierarchy a bit by setting UnboundLocalError = NameError).

-0

That was the case prior to Python 2.0. Reverting is potentially a 
semantic change that will break any code that distinguishes between 
(global) NameError and (local) UnboundLocalError. But personally, I 
don't know why it was thought necessary to distinguish between them in 
the first place.




-- 
Steven


More information about the Python-Dev mailing list