[New-bugs-announce] [issue39909] Assignment expression in assert causes SyntaxError
Михаил Кыштымов
report at bugs.python.org
Mon Mar 9 03:26:04 EDT 2020
New submission from Михаил Кыштымов <mister.rend at gmail.com>:
Assignment expression in assert causes SyntaxError
Minimal case:
```
assert var := None
```
Error:
```
File "<input>", line 1
assert var := None
^
SyntaxError: invalid syntax
```
Workaround:
```
assert (var := None)
```
My use case:
```
my_dict = dict()
assert value := my_dict.get('key')
```
----------
components: Interpreter Core
messages: 363698
nosy: Михаил Кыштымов
priority: normal
severity: normal
status: open
title: Assignment expression in assert causes SyntaxError
type: behavior
versions: Python 3.8
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39909>
_______________________________________
More information about the New-bugs-announce
mailing list