<div dir="auto"><div>Yes, I should have added ternary expressions to if statements. I can definitely see the use there.</div><div dir="auto"><br></div><div dir="auto">However, your example is not null checking. You'd have to modify it slightly to get that:</div><div dir="auto"><br></div><div dir="auto"><span style="font-family:sans-serif">None if var:= function() is None else var.</span><span style="font-family:sans-serif">method() </span></div><div dir="auto"><font face="sans-serif"><br></font></div><div dir="auto"><font face="sans-serif">Still not bad looking.<br></font><br><div class="gmail_quote" dir="auto"><div dir="ltr">On Thu, Apr 12, 2018, 11:01 PM Thautwarm Zhao <<a href="mailto:yaoxiansamma@gmail.com">yaoxiansamma@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"><br><div class="gmail_extra">
> You're looking at a very early commit there. I suggest looking at the<br>> most recent commits on one of two branches:<br><br>
<a href="https://github.com/Rosuav/cpython/blob/statement-local-variables/Grammar/Grammar" rel="noreferrer noreferrer" target="_blank">https://github.com/Rosuav/cpython/blob/statement-local-variables/Grammar/Grammar</a><br>
<a href="https://github.com/Rosuav/cpython/blob/assignment-expressions/Grammar/Grammar" rel="noreferrer noreferrer" target="_blank">https://github.com/Rosuav/cpython/blob/assignment-expressions/Grammar/Grammar</a><br>
<br>
> Those are the two most recent states in my progress towards (a)<br>
> statement-local name bindings with "EXPR as NAME", and (b) assignment<br>
> expressions with "target := value".
<br><br></div><div class="gmail_extra">Okay, and the syntax "target := value" seems to be much easier to handle with. <br><br></div><div class="gmail_extra">I do support this feature, but now I'm worried about the meaning of ':=', it seems to be a lazy assignment in some degree. I'm not sure using ':=' is proper here.<br><br><br>>
Inasmuch as I might like assignment expressions, it would only be in while or if statements, personally.
<br><br></div><div class="gmail_extra">Not exactly, assignment expression also works for "if expression", we can now have null checking.<br><br></div><div class="gmail_extra"> var.method() if var:= function() else None<br><br></div><div class="gmail_extra">Null checking is importance enough to have a specific syntax in many other languages(C#, kotlin, Ruby and so on), and we can even have more than null checking by adding expression assignment.<br><br></div><div class="gmail_extra"><br><br></div><div class="gmail_extra"><br></div></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></div></div>