f---ing typechecking

tsuraan tsuraan at gmail.com
Fri Feb 16 14:17:16 EST 2007


> Agreed. This would be similar to:
>
> py> 1 + 1.0
>
> Traceback: can only add int to int. Etc.
>
> But then again, the unimaginative defense would be that it wouldn't be
> python if you could catentate a list and a tuple.


Of course, that behaviour would be quite defensible; auto-casting int to
float is _wrong_, especially with python implementing abitrary precision
integers.  Integers are more precise than floats, so why would you
automatically cast them in that direction?

Seeing

>>> 0xffffffffffffffffff+1.0==float(0xffffffffffffffffff)
True

Is considerably more irritating than your hypothetical Traceback would be.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070216/32a9ad0e/attachment.html>


More information about the Python-list mailing list