<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:#000000">As long as any new syntax allowed us to still reference the occassional</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:#000000">thing in the older libraries that used newly reserved names, it would</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:#000000">not come up that often, and would avoid the biggest cost of a whole</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:#000000">new version.</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:#000000"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:#000000">If `foo` was a reserved word, then this could be allowed...</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:#000000"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:#000000"> import foo as bar</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:#000000"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:#000000">...but not these...</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:#000000"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:#000000"> import foo</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:#000000"> import bar as foo</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:#000000"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:#000000">The same could be done with params, so this would be illegal...</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:#000000"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:#000000">def f(foo): ...</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:#000000"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:#000000">...but this would be fine...</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:#000000"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:#000000">f(foo=1)</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:#000000"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:#000000">It would be illegal to define a property named `foo`, but you could</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:#000000">still do `bar.foo` to use a library, etc.</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:#000000"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:#000000">It could be done, but it's not especially relevant here, so I'll shut up now.</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:#000000"><br></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><span style="color:rgb(115,115,115);font-style:italic;line-height:18px"><font size="1" face="monospace, monospace">-- Carl Smith</font></span><br></div></div><div><span style="color:rgb(115,115,115);font-style:italic;line-height:18px"><font size="1" face="monospace, monospace"><a href="mailto:carl.input@gmail.com" target="_blank">carl.input@gmail.com</a></font></span></div></div></div></div></div></div>
<br><div class="gmail_quote">On 14 May 2018 at 03:47, Rob Cliffe via Python-ideas <span dir="ltr"><<a href="mailto:python-ideas@python.org" target="_blank">python-ideas@python.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF"><span class="">
<p><br>
</p>
<br>
<div class="m_4140162245655313627moz-cite-prefix">On 13/05/2018 19:19, Guido van Rossum
wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div>As anyone still following the inline assignment discussion
knows, a problem with designing new syntax is that it's hard
to introduce new keywords into the language, since all the
nice words seem to be used as method names in popular
packages. (E.g. we can't use 'where' because there's <a href="https://docs.scipy.org/doc/numpy-1.14.0/reference/generated/numpy.where.html" target="_blank">numpy.where</a>, and we can't use
'given' because it's used in <a href="http://hypothesis.readthedocs.io/en/latest/quickstart.html" target="_blank">Hypothesis</a>.)</div>
<div><br>
</div>
<div>The idea I had (not for the first time :-) is that in many
syntactic positions we could just treat keywords as names, and
that would free up these keywords.</div>
<div><br>
</div>
<div>For example, we could allow keywords after 'def' and after
a period, and then the following would become legal:</div>
<div><br>
</div>
<div>class C:</div>
<div> def and(self, other):</div>
<div> return ...</div>
<div><br>
</div>
<div>a = C()</div>
<div>b = C()<br>
</div>
<div>print(a.and(b))</div>
<div><br>
</div>
<div>This does not create syntactic ambiguities because after
'def' and after a period the grammar *always* requires a NAME.</div>
<div><br>
</div>
<div>There are other positions where we could perhaps allow
this, e.g. in a decorator, immediately after '@' (the only
keyword that's *syntactically* legal here is 'not', though I'm
not sure it would ever be useful).</div>
<div><br>
</div>
<br>
</div>
</blockquote></span>
Please, imagine how you would write the documentation to explain
this.<br>
Then, please, put yourself in the position of someone who teaches
Python trying to explain it.<br>
Regards<span class="HOEnZb"><font color="#888888"><br>
Rob Cliffe<br>
</font></span></div>
<br>______________________________<wbr>_________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">http://python.org/psf/<wbr>codeofconduct/</a><br>
<br></blockquote></div><br></div>