<div dir="ltr"><div><div><div><div><div><div><div><div><div><div><div>Why don't we allow any possible expression to be used in the context of a decorator? E.g. this is not possible.<br><br></div>@a + b<br></div>def function():<br></div> pass<br><br></div>While these are:<br><br></div>@a(b + c)<br></div><div>@a.b<br></div><div>@a.b.c<br></div>def function():<br></div> pass<br><br></div>I guess there we also had a discussion about whether or not to limit the grammar, and I guess we had a reason.<br><br></div>I don't like the idea to give the user too much freedom in f-string. A simple expression like addition, ok. But no comprehension, lambdas, etc... It's impossible to go back if this turns out badly, but we can always add more freedom later on.<br><br><br></div>One more coments after reading the PEP:<br></div>- I don't like that double braces are replaced by a single brace. Why not keep backslash \{ \} for the literals. In the PEP we have '{...}' for variables. (Instead of '\{...}') So that works fine.<br><div><div><br></div><div>Jonathan<br></div><div><br><br><div><div><div><div><div><div><br><br></div></div></div></div></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-08-08 12:28 GMT+02:00 Sven R. Kunze <span dir="ltr"><<a href="mailto:srkunze@mail.de" target="_blank">srkunze@mail.de</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 07.08.2015 21:17, Yury Selivanov wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Yes. And overall I think that<br>
<br>
sum = a + b<br>
print(f'the sum is {sum}')<br>
<br>
is more pythonic (readability, explicitness etc) than this:<br>
<br>
print(f'the sum is {a + b}')<br>
<br>
</blockquote>
<br></span>
I have to admit I like shorter one more. It is equally well readable and explicit AND it is shorter.<br>
<br>
As long as people do not abuse expressions to a degree of unreadability (which should be covered by code reviews when it comes to corporal code), I am fine with exposing more possibilities.<div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org" target="_blank">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="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" target="_blank">http://python.org/psf/codeofconduct/</a><br>
</div></div></blockquote></div><br></div>