2016-08-09 23:16 GMT-07:00 Gregory Ewing <greg.ew...@canterbury.ac.nz>:
> Juan Pablo Romero Méndez wrote: > > This is interesting. You are Ok having runtime errors? >> > > You're going to have runtime errors in any case, whether > they come from code you've put there yourself to check > types, or from somewhere deeper down. > You are correct. What I was trying to understand is if there is a much more relaxed attitude towards runtime errors in the Python community (even embracing it) than others* (and of course, how to handle those errors). (In certain communities people favor a design where exceptions / runtime errors only happen at program boundaries) > > The only difference is that checks you make yourself > *might* catch errors slightly sooner, and *might* be able > to provide better diagnostics. > > However, experience has shown that, the vast majority of > the time, type errors in Python are caught pretty much > immediately, and the stack trace provides more than > enough information to pin down the source of the problem. > So, putting in manual type checks is hardly ever worth > the effort, and can even be counterproductive, since it > interferes with duck typing. > > Occasionally there will be a situation where a type > error results in a corrupted data structure that leads > to problems later. But those cases are relatively rare > and best dealt with as they come up. > > -- > Greg > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list