r/ProgrammerHumor • • Aug 26 '20

Python goes brrrr

Post image
59.2k Upvotes

789 comments sorted by

View all comments

Show parent comments

1

u/mxzf Aug 26 '20

The issue is that it doesn't yield errors or warnings to the console for a lot of those type of issues.

1

u/g0liadkin Aug 26 '20

What error would you expect?

0

u/mxzf Aug 26 '20

In the case mentioned above, some kind of error about casting a NaN to string. In the more general case of casting between int and string, throwing a warning would be appropriate; a warning doesn't cause the program to break, but it makes the programmer aware that something is going on.

1

u/g0liadkin Aug 26 '20

So a mix of a warning in the console and the output that's being done right now, if I understood correctly

What do you think about the overhead that it implies with these extra checks at runtime, do you think warns is what the web should aim for?

0

u/[deleted] Aug 27 '20

[deleted]

2

u/mxzf Aug 27 '20

That's why warnings are nice rather than errors. Warnings just say "heads up, this is happening, just so you know and aren't surprised by weird behavior". It doesn't break anything, it just adds a few more console print statements (if your debug level is such that warnings are printed).