On Tue, May 10, 2011 at 1:06 AM, Eli Bendersky <eli...@gmail.com> wrote: > It probably shows the original complaint even more strongly. As for being a > problem with the suggested solution, I suppose you're right, although it > doesn't make it much different. Still, before a *possible* assignment to > 'x', it should be loaded as LOAD_NAME since it was surely not bound as > local, yet.
Yeah, I've decided I'm happier with the closure based arguments than the conditional statement related ones. "Assignments create local variables" is a relatively simple rule to reason about, and is equally valid for the current scope and for any nested scopes. The symtable analysis for nested scopes is ordering independent (and can't be changed for backwards compatibility reasons if nothing else), and UnboundLocalError is a natural outgrowth of applying those semantics to the current scope as well. Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com