<div dir="auto">-0 unless archived appropriately. List is the standard for decades. but I guess things change and I get old.</div><br><div class="gmail_quote"><div dir="ltr">On Wed, Feb 28, 2018, 13:49 Robert Vanden Eynde <<a href="mailto:robertve92@gmail.com">robertve92@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>We are currently like a dozen of people talking about multiple sections of a single subject.<br><br>Isn't it easier to talk on a forum?<br><b>Am I the only one</b> who thinks mailing list isn't easy when lots of people talking about multiple subjects?<br><br>Of course we would put the link in the mailing list so that everyone can join.<br><br>A forum (or just few "issues" thread on github) is where we could have different thread in parallel, in my messages I end up with like <b>10 comments not all related</b>, in a forum we could talk about everything and it would still be organized by subjects.<br><br>Also, it's more interactive than email on a global list, people can talk to each other in parallel, if I want to answer about a mail that was 10 mail ago, it gets quickly messy.<br><br></div>We could all discuss on a gist or some "Issues" thread on GitHub.<br></div><div class="gmail_extra"><br><div class="gmail_quote">2018-02-28 22:38 GMT+01:00 Robert Vanden Eynde <span dir="ltr"><<a href="mailto:robertve92@gmail.com" target="_blank" rel="noreferrer">robertve92@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><span>Le 28 févr. 2018 11:43, "Chris Angelico" <<a href="mailto:rosuav@gmail.com" target="_blank" rel="noreferrer">rosuav@gmail.com</a>> a écrit :<br><br>> It's still right-to-left, which is as bad as middle-outward once you<br>> combine it with normal left-to-right evaluation. Python has very<br></span>> little of this [..]<br><br>I agree [....]<span><br><br>>> 2) talking about the implementation of thektulu in the "where =" part.<br><br>> ?<br><br></span>In the Alternate Syntax, I was talking about adding a link to the <a href="https://github.com/thektulu/cpython/commits/where-expr" target="_blank" rel="noreferrer">thektulu (branch where-expr)</a><br>implementation as a basis of proof of concept (as you did with the other syntax).<br><br>>> 3) "C problem that an equals sign in an expression can now create a name inding, rather than performing a comparison."<br><br></div>As you agreed, with the "ch with ch = getch()" syntax we won't accidentally switch a "==" for a "=".<br><br></div>I agree this syntax :<br><div><div><br>```<span><br>while (ch with ch = getch()):<br> ...<br></span>```<br><br></div><div>doesn't read very well, but in the same way as in C or Java while(ch = getch()){} or worse ((ch = getch()) != null) syntax.<br></div><div>Your syntax "while (getch() as ch):" may have a less words, but is still not clearer.<br><br></div><div>As we spoke on Github, having this syntax in a while is only useful if the variable does leak.<br></div><div><span><br>>> 5) Any expression vs "post for" only<br><br></span><span>> I don't know what the benefit is here, but sure. As long as the<br>> grammar is unambiguous, I don't see any particular reason to reject<br>> this.<br><br></span></div><div>I would like to see a discussion of pros and cons, some might think like me or disagree, that's a strong langage question.<br></div><div><span><br>> 6) with your syntax, how does the simple case work (y+2 with y = x+1) ?<br><br></span><span>What simple case? The case where you only use the variable once? I'd<br>write it like this:<br><br>(x + 1) + 2<br><br>>> The issue is not only about reusing variable.<br><br>> If you aren't using the variable multiple times, there's no point<br>> giving it a name. Unless I'm missing something here?<br><br></span></div><div>Yes, variables are not there "just because we reuse them", but also to include temporary variables to better understand the code.<br></div><div>Same for functions, you could inline functions when used only once, but you introduce them for clarity no ?<br></div><div><br>```<br></div><div>a = v ** 2 / R # the acceleration in a circular motion<br></div><div>f = m * a # law of Newton<br>```<br><br></div><div>could be written as <br><br><div>```<br></div>f = m * (v ** 2 / R) # compute the force, trivial<br><div>```<br><br></div><div>But having temporary variables help a lot to understand the code, otherwise why would we create temporary variables ?<br></div><div>I can give you an example where you do a process and each time the variable is used only one.<br></div></div><div><br>>> 8)<span><br>>> (lambda y: [y, y])(x+1)<br>>> Vs<br>>> (lambda y: [y, y])(y=x+1)<br><br></span><span>Ewww. Remind me what the benefit is of writing the variable name that<br>many times? "Explicit" doesn't mean "utterly verbose".<br><br></span></div><div>Yep it's verbose, lambdas are verbose, that's why we created this PEP isn't it :)<br></div><span><div><br>> 10) Chaining, in the case of the "with =", in thektulu, parenthesis were<br>> mandatory:<br>><br>> print((z+3 with z = y+2) with y = x+2)<br>><br>> What happens when the parenthesis are dropped ?<br>><br>> print(z+3 with y = x+2 with z = y+2)<br>><br>> Vs<br>><br>> print(z+3 with y = x+2 with z = y+2)<br>><br>> I prefer the first one be cause it's in the same order as the "post for"<br>><br>> [z + 3 for y in [ x+2 ] for z in [ y+2 ]]<br><br>> With my proposal, the parens are simply mandatory. Extending this to<br>> make them optional can come later.<br><br></div></span><div>Indeed, but that's still questions that can be asked.<br></div><span><div><br>>> 11) Scoping, in the case of the "with =" syntax, I think the parenthesis<br>>> introduce a scope :<br>>><br>>> print(y + (y+1 where y = 2))<br>>><br>>> Would raise a SyntaxError, it's probably better for the variable beeing<br>>> local and not in the current function (that would be a mess).<br>>><br>>> Remember that in list comp, the variable is not leaked :<br>>><br>>> x = 5<br>>> stuff = [y+2 for y in [x+1]<br>>> print(y) # SyntaxError<br><br>> Scoping is a fundamental part of both my proposal and the others I've<br>> seen here. (BTW, that would be a NameError, not a SyntaxError; it's<br>> perfectly legal to ask for the name 'y', it just hasn't been given any<br>> value.) By my definition, the variable is locked to the statement that<br>> created it, even if that's a compound statement. By the definition of<br>> a "(expr given var = expr)" proposal, it would be locked to that<br>> single expression.<br><br></div></span><div>Confer the discussion on scoping on github (<a href="https://github.com/python/peps/commit/2b4ca20963a24cf5faac054226857ea9705471e5" target="_blank" rel="noreferrer">https://github.com/python/peps/commit/2b4ca20963a24cf5faac054226857ea9705471e5</a>) :<br><div class="m_3152610867237166502m_5751700897584855200gmail-comment-body m_3152610867237166502m_5751700897584855200gmail-markdown-body m_3152610867237166502m_5751700897584855200gmail-js-comment-body">
<p>"""<br>In the current implementation it looks like it is like a regular assignment (function local then).</p>
<p>Therefore in the expression usage, the usefulness would be debatable (just assign before).</p>
<p>But in a list comprehension <em>after the for</em> (as I mentioned in my mail), aka. when used as a replacement for <code>for y in [ x + 1 ]</code> this would make sense.</p>
<p>But I think that it would be much better to have a local scope, in the parenthesis. So that <code>print(y+2 where y = x + 1)</code> wouldn't leak y. And when there are no parenthesis like in <code>a = y+2 where y = x+1</code>, it would imply one, giving the same effect as <code>a = (y+2 where y = x+1)</code>. Moreover, it would naturally shadow variables in the outermost scope.</p>
<p>This would imply <code>while data where data = sock.read():</code> does not leak <code>data</code> but as a comparison with C and Java, the syntax while((data = sock.read()) != null) is really really ugly and confusing.</p>
</div>"""<br></div></div></div>
</blockquote></div><br></div>
_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org" target="_blank" rel="noreferrer">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer noreferrer" target="_blank">http://python.org/psf/codeofconduct/</a><br>
</blockquote></div>