On Fri, Apr 15, 2016, 7:56 PM <sohcahto...@gmail.com> wrote: > On Thursday, April 14, 2016 at 1:48:40 PM UTC-7, Michael Selik wrote: > > I suggest not worrying about sanitizing inputs. If someone provides bad > > data, Python will do the right thing: stop the program and print an > > explanation of what went wrong, often a more helpful message than one > you'd > > write. Use error handling mostly for when you want to do something > *other* > > than stop the program. > > > > I'm not sure I'd use NaN instead of raise division by zero error. NaNs > can > > be troublesome for downstream code that might not notice until it gets > > confusing. A div-by-zero error is clear and easier to track down because > of > > the traceback. > > I'd much rather sanitize the inputs and tell the user they did something > bad than to have the script crash and give a 500 Internal Server Error to > the user. >
Right, my advice was only good if the user can read the original error and traceback. And can restart the program, etc. Even worse, I definitely wouldn't want to give any hints of the source code > organization by letting the user see the traceback. > Depends on the kind of user you have. > -- https://mail.python.org/mailman/listinfo/python-list