You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Python 3.13.0a0 (heads/main:217f47d6e5, Jul 6 2023, 07:20:36) [Clang 14.0.0 (clang-1400.0.29.202)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> foo = ["a", "b"]
>>> for i in ["c"]:
... foo.remove(i)
...
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
ValueError: 'c' is not in list
Now the error message is updated, here is the rationale why I agree with the updating error message even if for the possibility of large input.
Activity
pochmann commentedon Sep 15, 2022
What if
xis large, so large that it pushes the previous error-information off-screen or even out of the screen buffer?What if the conversion of
xto string takes a long time or causes another error? (Think of the current large int issue).Maybe it could be done for known small good types and values.
Then again, for example
set.removealready does this:x = 1; {0}.remove(x)shows:x = 10**1000000; {0}.remove(x)takes a long time and then prints a lot (testing with Python version without the new string conversion limit).shows:
ericvsmith commentedon Sep 15, 2022
Wouldn't we already have this problem with KeyError on dict lookups:
?
I guess you could argue that the value should be removed from KeyError.
pythongh-96844: Improve error message of list.remove
gh-96844: Improve error message of list.remove (gh-106455)
corona10 commentedon Jul 5, 2023
Now the error message is updated, here is the rationale why I agree with the updating error message even if for the possibility of large input.
#106455 (comment)
cc @tdegeus @pochmann @ericvsmith
pythongh-96844: Improve error message of list.remove (pythongh-106455)
Revert "pythongh-96844: Improve error message of list.remove (pythong…
Revert "pythongh-96844: Improve error message of list.remove (pythong…
Revert "gh-96844: Improve error message of list.remove (gh-106455)" (#…
Revert "pythongh-96844: Improve error message of list.remove (pythong…
Revert "pythongh-96844: Improve error message of list.remove (pythong…
Revert "pythongh-96844: Improve error message of list.remove (pythong…