2010/6/13 Antoine Pitrou <span dir="ltr"><<a href="mailto:solipsis@pitrou.net">solipsis@pitrou.net</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
On Fri, 11 Jun 2010 21:18:48 -0400<br>
Demur Rumed <<a href="mailto:junkmute@hotmail.com">junkmute@hotmail.com</a>> wrote:<br>
><br>
> For example,<br>
><br>
> def f(x):<br>
>     a.append(x)<br>
>     if len(a)>5:a=[5]<br>
><br>
> If a is bound as a local, this throws an UnboundLocalError. Why then is it not set to try the global namespace, that place we cannot be so certain of the exception in?<br>
><br>
> It comes down to the view of UnboundLocalError as a feature or a bug<br>
<br>
Certainly a feature. In case of ambiguity, a variable should be<br>
considered local rather than global. It makes the language much safer.<br>
<br>
It's also why I'm -1 on your proposal.<br>
<br>
Regards<br>
<br>
Antoine.<br>
<br>
_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/python-ideas" target="_blank">http://mail.python.org/mailman/listinfo/python-ideas</a></blockquote><div><br></div><div>Locals are also MUCH faster...</div><div><br></div><div>
Cesare </div><br>