[Tutor] Value Error

Steve Willoughby steve at alchemy.com
Wed Jun 12 23:46:56 CEST 2013


int('blah') is not a type error because the int() function is expecting to be given a string, and it was given a string. The 'blah' is of the correct type.
The problem is that int() couldn't do anything useful with the value of that string.

Steve

On 12-Jun-2013, at 14:41, Jim Mooney <cybervigilante at gmail.com> wrote:

> Dave Angel <davea at davea.name>
> 
>    import math
> print math.sqrt(-1)
> 
> Ah, that's what I was looking for. I already saw it trip on type mismatches like int('blah'). I was looking for what would be an actual inappropriate value that was still the right type.  Although I'm not sure why int('blah') wouldn't be a type error rather than a value error.
> 
> Jim 
> 
> 
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130612/4482fe1d/attachment.html>


More information about the Tutor mailing list