<div class="gmail_quote">On Thu, Jul 16, 2009 at 9:02 PM, Greg Ewing <span dir="ltr"><<a href="mailto:greg.ewing@canterbury.ac.nz">greg.ewing@canterbury.ac.nz</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I would expect x to be bound in the current scope,<br>
not the where-block scope. But I would expect<br>
<br>
  x[i] = 5 where:<br>
    x = y<br>
    i = 7<br>
<br>
to be equivalent to<br>
<br>
  y[7] = 5<br></blockquote></div><br>How about if attempts to re-bind variables in outer scopes should throw an exception?  Much like they already do in this example:<br><br>>>> x = 5<br>>>> def foo():<br>
...   blah = x<br>...   x = 6<br>...<br>>>> foo()<br>Traceback (most recent call last):<br>  File "<stdin>", line 1, in <module><br>  File "<stdin>", line 2, in foo<br>UnboundLocalError: local variable 'x' referenced before assignment<br>
<br>(rebinding is allowed if "global" or "nonlocal" is explicitly used, of course)<br><blockquote style="margin: 1.5em 0pt;">--<br>
Daniel Stutzbach, Ph.D.<br>
President, <a href="http://stutzbachenterprises.com">Stutzbach Enterprises, LLC</a>
</blockquote>