Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

+1.

It should thrown an exception and abort the script with an ugly error traceback.

If the documentation says "float" and you can hand it a numerical string, then either the function or its documentation have a bug that needs correcting.



I wouldn't go as far as throwing an exception. A notice maybe.


Asking a function that formats a number and that is defined that way in the documentation to format a string is a programming mistake. As the discussion clearly states, it's a minor change in application code that would make it both clearer and more robust.

I would go as far as recommend using a USB shock device to issue a warning to the programmer every times a mistake like this is made. ;-)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: