[issue39909] Assignment expression in assert causes SyntaxError

2020-03-09 Thread Михаил Кыштымов
Михаил Кыштымов added the comment: ok -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.

[issue39909] Assignment expression in assert causes SyntaxError

2020-03-09 Thread Eric V. Smith
Eric V. Smith added the comment: I'm going to close this, since I can't imagine this restriction being relaxed. -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker

[issue39909] Assignment expression in assert causes SyntaxError

2020-03-09 Thread STINNER Victor
STINNER Victor added the comment: > assert var := None It's good that this syntax is rejected: it looks like a typo (assert var == None). Moreover, it's part of of the PEP 572 design. https://www.python.org/dev/peps/pep-0572/#exceptional-cases Python works as expected, I suggest to close the

[issue39909] Assignment expression in assert causes SyntaxError

2020-03-09 Thread Михаил Кыштымов
Михаил Кыштымов added the comment: if this is by design i'm fine with somebody closing this issue. i've not found mention of such case in pep so i though it's not by design. docs say `assert` just takes "expression" and "assignment expression" has "expression" in it's name. https://docs.python

[issue39909] Assignment expression in assert causes SyntaxError

2020-03-09 Thread Eric V. Smith
Eric V. Smith added the comment: I believe this is by design, as is the same restriction on statement-level assignment expressions. And if requiring parens discourages the use of assignment expressions in asserts, I think that's a good thing. Why not just use the workaround you've already id

[issue39909] Assignment expression in assert causes SyntaxError

2020-03-09 Thread Михаил Кыштымов
New submission from Михаил Кыштымов : Assignment expression in assert causes SyntaxError Minimal case: ``` assert var := None ``` Error: ``` File "", line 1 assert var := None ^ SyntaxError: invalid syntax ``` Workaround: ``` assert (var := None) ``` My use case: ``` my_d