<div dir="ltr"><div class="gmail_default" style="font-family:monospace,monospace"><span style="font-family:arial,sans-serif">On Wed, Sep 6, 2017 at 8:17 PM, Benjamin Peterson </span><span dir="ltr" style="font-family:arial,sans-serif"><<a href="mailto:benjamin@python.org" target="_blank">benjamin@python.org</a>></span><span style="font-family:arial,sans-serif"> wrote:</span><br></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>On Wed, Sep 6, 2017, at 10:08, Antoine Pitrou wrote:<br>
> On Wed, 06 Sep 2017 09:42:29 -0700<br>
> Benjamin Peterson <<a href="mailto:benjamin@python.org" target="_blank">benjamin@python.org</a>> wrote:<br>
> > On Wed, Sep 6, 2017, at 03:14, Antoine Pitrou wrote:<br>
> > ><br>
> > > Hello,<br>
> > ><br>
> > > I'm a bit concerned about<br>
> > > <a href="https://github.com/python/cpython/commit/76d5abc8684bac4f2fc7cccfe2cd940923357351" rel="noreferrer" target="_blank">https://github.com/python/cpyt<wbr>hon/commit/76d5abc8684bac4f2fc<wbr>7cccfe2cd940923357351</a><br>
> > ><br>
> > > My main gripe is that makes writing C code more tedious.  Simple C<br>
> > > global variables such as "_once_registry" are now spelled<br>
> > > "_PyRuntime.warnings.once_regi<wbr>stry".  The most egregious example seems<br>
> > > to be "_PyRuntime.ceval.gil.locked" (used to be simply "gil_locked").<br>
> > ><br>
> > > Granted, C is more verbose than Python, but it doesn't have to become<br>
> > > that verbose.  I don't know about you, but when code becomes annoying<br>
> > > to type, I tend to try and take shortcuts.<br>
> ><br>
> > How often are you actually typing the names of runtime globals, though?<br>
><br>
> Not very often, but if I want to experiment with some low-level<br>
> implementation details, it is nice to avoid the hassle.<br>
<br>
</span>It seems like this could be remediated with some inline functions or<br>
macros, which would also help safely encapsulate state.<br>
<span><br>
><br>
> There's also a readability argument: with very long names, expressions<br>
> can become less easy to parse.<br>
><br>
> > If you are using a globals, perhaps the typing time will allow you to<br>
> > fully consider the gravity of the situation.<br>
><br>
> Right, I needed to be reminded of how perilous the use of C globals is.<br>
> Perhaps I should contact the PSRT the next time I contemplate using a C<br>
> global.<br>
<br>
</span>It's not just you but future readers.</blockquote><div><br></div><div class="gmail_default" style="font-family:monospace,monospace">Great. Related to this, there is also discussion on dangers of globals and other widely-scoped variables in the Rationale section of PEP 555 (Context-local variables), for anyone interested. But if you read the draft I posted on python-ideas last Monday, you've already seen it.</div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace">––Koos</div><div class="gmail_default" style="font-family:monospace,monospace"><br></div></div><div><br></div>-- <br><div class="m_-287620452800584064gmail_signature" data-smartmail="gmail_signature">+ Koos Zevenhoven + <a href="http://twitter.com/k7hoven" target="_blank">http://twitter.com/k7hoven</a> +</div>
</div></div>