Is there an analogue to Java IllegalStateException in Python?
In Python, that would be ValueError, or a subclass of it.
For example, trying to .read() a closed file raises "ValueError: I/O operation on closed file".
IllegalStateException is often used in Java when a method is invoked on an object in inappropriate state. What would you use instead in Python?