Yes, I should have added ternary expressions to if statements. I can
definitely see the use there.
However, your example is not null checking. You'd have to modify it
slightly to get that:
None if var:= function() is None else var.method()
Still not bad looking.
On Thu, Apr 12, 2018, 11:01 PM Thautwarm Zhao <yaoxiansa...@gmail.com>
> > You're looking at a very early commit there. I suggest looking at the
> > most recent commits on one of two branches:
> > Those are the two most recent states in my progress towards (a)
> > statement-local name bindings with "EXPR as NAME", and (b) assignment
> > expressions with "target := value".
> Okay, and the syntax "target := value" seems to be much easier to handle
> 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.
> > Inasmuch as I might like assignment expressions, it would only be in
> while or if statements, personally.
> Not exactly, assignment expression also works for "if expression", we can
> now have null checking.
> var.method() if var:= function() else None
> 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.
> Python-ideas mailing list
> Code of Conduct: http://python.org/psf/codeofconduct/
Python-ideas mailing list
Code of Conduct: http://python.org/psf/codeofconduct/