Closed
Description
Steps to reproduce
- Create a file a.py
- Paste this to it:
def is_odd(n):
return n % 2 != 0 and n
print([odd for i in range(100) if (odd := is_odd(i))])
- run pylint a.py
Current behavior
************* Module a
a.py:5:0: C0325: Unnecessary parens after 'if' keyword (superfluous-parens)
------------------------------------------------------------------
Expected behavior
This should not complain about the parenthesis because without it the syntax is invalid when using the walrus :=
operator
pylint --version output
pylint 2.4.4
astroid 2.3.3
Python 3.8.0 (default, Oct 17 2019, 17:08:29)
[Clang 11.0.0 (clang-1100.0.33.8)]