[issue44223] := in comprehensions does not work

2021-05-24 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Well, it works, but the priority of := is lower than priority of other operators. (x := item.upper() not in "ABC") is interpreted as (x := (item.upper() not in "ABC")). -- resolution: -> not a bug stage: -> resolved status: open -> closed

[issue44223] := in comprehensions does not work

2021-05-24 Thread Dennis Sweeney
Dennis Sweeney added the comment: The parser rejects this ambiguity and requires parentheses: [ xxx for item in collection if (xxx := mutator(item)) is not None ] Example ambiguity: >>> [x for item in "abcdefabc" if x := item.upper() not in "ABC"] SyntaxError: invalid syntax >>>

[issue44223] := in comprehensions does not work

2021-05-24 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: "Does not work" is not informative. What did you get and what did you expect to get? Please proved a complete reproducible example. -- nosy: +serhiy.storchaka ___ Python tracker

[issue44223] := in comprehensions does not work

2021-05-24 Thread Марк Коренберг
New submission from Марк Коренберг : [ xxx for item in collection if xxx := mutator(item) is not None ] -- components: Interpreter Core, Parser messages: 394233 nosy: lys.nikolaou, pablogsal, socketpair priority: normal severity: normal status: open title: := in