PyCQA / pycodestyle

Simple Python style checker in one Python file

Home Page:https://pycodestyle.pycqa.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

E203 and E231 generated for "walrus" operator

darrincedwards opened this issue · comments

This may be a duplicate of this issue, but that seemed focused on list slices.

For code that attempts to use the python 3.8 "assisnment expression", also known as the "walrus" operator, I get the following (running flake8 3.7.9 with pycodestyle 2.5.0):

darrin@cornelia ~> flake8 (echo 'actual_float = float(txt_float := "3.14")' | psub)
"pyflakes" failed during execution due to "'FlakesChecker' object has no attribute 'NAMEDEXPR'"
Run flake8 with greater verbosity to see more details
/tmp/.psub.Aza7RP6fl1:1:31: E203 whitespace before ':'
/tmp/.psub.Aza7RP6fl1:1:32: E231 missing whitespace after ':'

Attempting to add / remove space in and around the := operator just generates different errors (and many of those aren't valid python anyway).

You should update to a version that supports assignment expressions, i.e. 2.6.0 or higher, released 2 years ago.

* Add support for assignment expressions ``:=`` (PEP 572). PR #879.

(I also cannot reproduce this on 2.8.0, FWIW.)

general advice for open source: always check the newest released version and the latest revision of the primary branch -- 2.5.0 was released a full year before python 3.8 was released