News for hackers. Stuff that matters.
Re:PEP 572: Python assignment expressions has been accepted by LyndsySimon on Thursday July 12, 2018 @12:25PM (#17516119)
I think I would probably write

    [bar(foo(z)) for z in stuff if foo(z)]
as

    [bar(y) for y in (z for z in stuff if foo(z))]
or even as

    [bar(y) for y in filter(foo, stuff)]
... although, I get that `map`, `apply`, and `filter` aren't generally considered pythonic.

Overall, I think I agree with you - the new syntax in PEP572 might be handy, but it isn't necessary and I would say that the cognitive overhead of encountering yet another syntax doesn't justify the benefit, much less the technical overhead for the interpreter.

Re:PEP 572: Python assignment expressions has been accepted by eswoo on Thursday July 12, 2018 @08:21PM (#17519674)
It needs to be

    [bar(foo(y)) for y in (z for z in stuff if foo(z))]
(etc.) though, since `bar` takes as input the output of `foo`. This leads to the objectionable duplicate calls to `foo`, hence the new assignment expressions.

I like Dunnorandom's

    [bar(x) for x in map(foo, stuff) if x]
best for a correct result using existing syntax, or

    [bar(x) for y in (foo(x) for x in stuff) if y]
if you don't like `map`.