Subscript assignment in Python 3.9
See original GitHub issueWhat I did
I want to see live coding variable values for a numpy array created as below and assigning a value to one of the element.
import numpy as np
tempArr = np.zeros(5)
tempArr[0] = 0 #problematic line
print(tempArr)
What happened
Everything works but as soon as assignment expression is executed no output is shown in live code. (PyCharm plugin)
tempArr[0] = 0
What I wanted to happen
I would like to print all lines in live code including assignment line as blank line.
tempArr = array([0., 0., 0., 0., 0.])
print('[0. 0. 0. 0. 0.]')
My environment
Describe the versions of everything you were using:
- Editor PyCharm
- Operating system MacOS
- Python 3.9
Other feedback
I a new python learner and enjoyed Live Code thoroughly. Planning to use it as much as possible but above error is stopping me to use it. Thanks for making such a great tool !
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Assignment Expressions: The Walrus Operator - Real Python
The assignment expression allows you to assign True to walrus , and immediately print the value. But keep in mind that the walrus...
Read more >python - Cannot use assignment expressions with subscript
There is some justification for the decision to disallow more complex assignments in assignment expressions given on the python-dev mailing ...
Read more >PEP 572 – Assignment Expressions
Python already has a rule that subexpressions are generally evaluated from left to right. However, assignment expressions make these side effects more visible, ......
Read more >What are Python Assignment Expressions and Using the ...
Each new version of Python adds new features to the language. For Python 3.8, the biggest change is the addition of assignment expressions....
Read more >How To Use Assignment Expressions in Python - DigitalOcean
You initialize a list named some_list that contains three elements. Then, the if statement uses the assignment expression ((list_length := len( ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Thanks for the bug report. It looks like a problem with Python 3.9, so I’ll dig into it. It doesn’t seem related to numpy, because this fails in the same way:
There’s probably some new class in the
astmodule that I have to support.Thanks a lot !