<span class="gmail_quote">On 7/1/06, <b class="gmail_sendername">Josiah Carlson</b> &lt;<a href="mailto:jcarlson@uci.edu">jcarlson@uci.edu</a>&gt; wrote:</span><br><div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
&gt; There's one very simple way we could do this in Py3k<br>&gt; without requiring any new syntax or keywords: just<br>&gt; redefine the meaning of &quot;global&quot; to mean &quot;not local&quot;.<br><br>I would probably be a solid -0 on such a proposal; I still don't think
<br>it's really necessary, but I've never used (or really seen) global more<br>than one level deep, so would guess its impact would be low.<br></blockquote></div><br clear="all">This has been discussed at length in the following thread that I started in February and at least one time before that.
<br><br><a href="http://mail.python.org/pipermail/python-dev/2006-February/061568.html">http://mail.python.org/pipermail/python-dev/2006-February/061568.html</a><br><br>I think using the &quot;global&quot; keyword is probably the lowest impact form and has the least amount of backwards incompatibility.&nbsp; Below is the part of the last thread that I talked about changing the meaning of &quot;global.&quot;
<br><br><a href="http://mail.python.org/pipermail/python-dev/2006-February/061852.html">http://mail.python.org/pipermail/python-dev/2006-February/061852.html</a><br><br><div style="margin-left: 40px;"><pre>Having the &quot;global&quot; keyword semantics changed to be &quot;lexically global&quot;
<br>would break in the cases that &quot;global&quot; is used on a name within a<br>nested scope that has an enclosing scope with the same name.  I would<br>suppose that actual instances in real code of this would be rare.
<br><br>Consider:<br>&gt;&gt;&gt;<i> x = 1<br></i>&gt;&gt;&gt;<i> def f() :<br></i>...   x = 2<br>...   def inner() :<br>...     global x<br>...     print x<br>...   inner()<br>...<br>&gt;&gt;&gt;<i> f()<br></i>1<br><br>Under the proposed rules:
<br>&gt;&gt;&gt;<i> f()<br></i>2<br><br>PEP 227 also had backwards incompatibilities that were similar and I<br>suggest handling them the same way by issuing a warning in these cases<br>when the new semantics are not being used (
i.e. no &quot;from __future__&quot;).</pre></div><br>Most people probably think that this is a low impact &quot;wart&quot; on the Python language that not really worth fixing as there are workarounds (i.e. mutable objects) or other ways to express (
i.e. use classes) such things, but it does trip people up from time to time as warts typically do--I guess that's why this gets brought up now and again. <br><br>Best regards,<br>Almann<br><br>-- <br>Almann T. Goo<br><a href="mailto:almann.goo@gmail.com">
almann.goo@gmail.com</a>