Removing an element not currently in a list: ValueError?
- by Izkata
This is something that's bothered me for a while, and I can't figure out why anyone would ever want the language to act like this:
In [1]: foo = [1, 2, 3]
In [2]: foo.remove(2) ; foo # okay
Out[2]: [1, 3]
In [3]: foo.remove(4) ; foo # not okay?
---------------------------------------------------------------------------
ValueError …