pythontutor-dev / pythontutor

11 stars 4 forks source link

weird user-reported python error! very strange #92

Open pgbovine opened 5 years ago

pgbovine commented 5 years ago

http://pythontutor.com/visualize.html#code=t%20%3D%201,%202,%203,%204,%205%0Aprint%28list%28t%29%29%20%20%23%20%5B1,%202,%203,%204,%205%5D%0At%5B0%5D%20%3D%205%20%20%23%20TypeError%3A%20'tuple'%20object%20does%20not%20support%20item%20assignment&cumulative=false&heapPrimitives=nevernest&mode=edit&origin=opt-frontend.js&py=3&rawInputLstJSON=%5B%5D&textReferences=false

misingnoglic commented 5 years ago

Another point, if you click to visualize it (letting it return the error), delete the line "t[0] = 5", and then visualize it again, it will still give an error. Visualizing a third time will run as expected.

blueglyph commented 5 years ago

The comment on the last line seems to be the problem, removing it makes it run normally, both in visualization mode and in live mode.

# TypeError: 'tuple' object does not support item assignment

=> removing the word 'TypeError' solves the problem, after clicking two times on Visualization as the 2nd poster said (first post was incomplete).