On 2010-10-13, Chris Rebert <c...@rebertia.com> wrote: > For future reference, the significant majority of things in Python > raise exceptions upon encountering errors rather than returning error > values of some sort.
Yes. I'm getting used to that -- it's a bit of a shift, because I'm used to exceptions being *exceptional* -- as in, not a failure mode you would expect to see happening. So for instance, I wouldn't expect to get an exception for EOF, because that's not exceptional, that's virtually guaranteed to happen whenever you interact with files. I am gonna have to retrain a bit. > Aside from APIs which explicitly provide a parameter to be returned as > a default value in case of error (e.g. getattr(obj, name, default)), > the only common exception* I can come up with off the top of my head > is str.find()**, and even that has an exception-throwing cousin, > str.index(). Interesting! That may take me some getting used to. -s -- Copyright 2010, all wrongs reversed. Peter Seebach / usenet-nos...@seebs.net http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated! I am not speaking for my employer, although they do rent some of my opinions. -- http://mail.python.org/mailman/listinfo/python-list