[Tutor] Value Error
Dave Angel
davea at davea.name
Wed Jun 12 23:19:20 CEST 2013
On 06/12/2013 04:49 PM, Jim Mooney wrote:
> I'm going through the exceptions so I can recall and use the basic ones
> (not much use for unicode errors at this point ;') But I'm puzzled by an
> aspect of the Value Error:
> *exception *ValueError
>
> Raised when a built-in operation or function receives an argument that has
> the right type but an inappropriate value, and the situation is not
> described by a more precise exception such as
> IndexError<http://docs.python.org/2/library/exceptions.html#exceptions.IndexError>
> .
>
> I know you can bring this error up easily with a wrong user input, but
> within a program, what would be an example of something that is the "right
> type but an inappropriate value"?
>
>
import math
print math.sqrt(-1)
More information about the Tutor
mailing list