Why does list.index throw an exception, instead of using an arbitrary value (for example, -1)? What\'s the idea behind this?
-1
To me it looks cleaner to d
It's a semantic argument. If you want to know the index of an element, you are claiming that it already exists in the list. If you want to know whether or not it exists, you should use in.
in