question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Walrus operator incorrectly shows error on Windows app

See original GitHub issue

Description

What steps will reproduce the problem?

The walrus operator (:=) is valid in python 3.8. The following code is valid, but Spyder puts an error icon in the gutter. That error is incorrect! print(foo:=“hello”) hello

print(foo) hello

More info at: https://docs.python.org/3/whatsnew/3.8.html

Versions

  • Spyder version: 5.2.2
  • Python version: 3.7.9
  • Qt version: 5.12.10
  • PyQt5 version: 5.12.3
  • Operating System: Windows 10

Dependencies

# Mandatory:
atomicwrites >=1.2.0          :  1.4.0 (OK)
chardet >=2.0.0               :  4.0.0 (OK)
cloudpickle >=0.5.0           :  2.0.0 (OK)
cookiecutter >=1.6.0          :  1.7.3 (OK)
diff_match_patch >=20181111   :  20200713 (OK)
intervaltree                  :  None (OK)
IPython >=7.6.0;<8.0.0        :  7.31.1 (OK)
jedi >=0.17.2;<0.19.0         :  0.18.1 (OK)
jellyfish >=0.7               :  0.9.0 (OK)
jsonschema >=3.2.0            :  4.4.0 (OK)
keyring >=17.0.0              :  23.5.0 (OK)
nbconvert >=4.0               :  6.4.0 (OK)
numpydoc >=0.6.0              :  1.1.0 (OK)
paramiko >=2.4.0              :  2.9.2 (OK)
parso >=0.7.0;<0.9.0          :  0.8.3 (OK)
pexpect >=4.4.0               :  4.8.0 (OK)
pickleshare >=0.4             :  0.7.5 (OK)
psutil >=5.3                  :  5.9.0 (OK)
pygments >=2.0                :  2.11.2 (OK)
pylint >=2.5.0                :  2.12.2 (OK)
pyls_spyder >=0.4.0           :  0.4.0 (OK)
pylsp >=1.3.2;<1.4.0          :  1.3.3 (OK)
pylsp_black >=1.0.0           :  1.0.1 (OK)
qdarkstyle =3.0.2             :  3.0.2 (OK)
qstylizer >=0.1.10            :  0.2.1 (OK)
qtawesome >=1.0.2             :  1.1.1 (OK)
qtconsole >=5.2.1;<5.3.0      :  5.2.2 (OK)
qtpy >=1.5.0                  :  2.0.0 (OK)
rtree >=0.9.7                 :  0.9.7 (OK)
setuptools >=49.6.0           :  60.5.0 (OK)
sphinx >=0.6.6                :  4.3.2 (OK)
spyder_kernels >=2.2.1;<2.3.0 :  2.2.1 (OK)
textdistance >=4.2.0          :  4.2.2 (OK)
three_merge >=0.1.1           :  0.1.1 (OK)
watchdog                      :  2.1.6 (OK)
zmq >=17                      :  22.3.0 (OK)

# Optional:
cython >=0.21                 :  0.29.26 (OK)
matplotlib >=2.0.0            :  3.5.1 (OK)
numpy >=1.7                   :  1.19.3 (OK)
pandas >=1.1.1                :  1.3.5 (OK)
scipy >=0.17.0                :  1.7.3 (OK)
sympy >=0.7.3                 :  1.9 (OK)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
iamleviscommented, Mar 14, 2022

I’m afraid the image isn’t especially illuminating, but here you are: image

0reactions
ccordoba12commented, Mar 17, 2022

I can’t reproduce this in an environment with Python 3.8. I think it is flagged as an error in our current Windows installer because it’s built with Python 3.7 and the Walrus operator was added in 3.8.

So, I’m going to close this issue as fixed and link it to the PR that updated our Windows for our next version (5.3.0).

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - yield with walrus operator := causes syntax error
Show activity on this post. You need to add parenthesis around the walrus operator like this: yield (excel := Dispatch("Excel.Application")).
Read more >
Assignment Expressions: The Walrus Operator - Real Python
In this video, you'll learn about what's being called the walrus operator. One of the biggest changes in Python 3.8 is the introduction...
Read more >
What's New In Python 3.8 — Python 3.11.1 documentation
It is affectionately known as “the walrus operator” due to its resemblance to the eyes and tusks of a walrus. In this example,...
Read more >
Python should take a lesson from APL: Walrus operator not ...
The walrus operator not only prevents that problem, but makes the intent unambiguous. Which is a perfectly valid point. I get it. Still,...
Read more >
Python's Assignment Expressions and Fixing a Botched ...
Have you started to use Python's assignment expression in your code? Maybe you have heard them called the walrus operator.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found