On Sat, 4 Dec 2010 17:07:45 +0000 (UTC) Harishankar <v.harishan...@gmail.com> wrote: > Of course not. But going by the replies here, it appears that Python has > made exceptions as the "norm" for error handling which is ironical > considering the meaning of the word "exception". I find a bit cumbersome > that exceptions are advocated for certain conditions which can be sanely > worked around in the application's logic and even avoided, rather than > waiting for them to get caught and providing an unsatisfactory result.
It just seems to me that you have a semantic issue rather than a technical one. If the word "exception" was replaced by "check" or something else would that make the process easier to swallow? try: somefunc() check ValueError: handle_error() Whatever it's called it's just flow control. > > Quite often it's impossible for the function to know what needs to be > > done when a specific conditions arises, in which case (presumably) you > > have to return some error code and test for that ... > > Not necessarily. I wasn't talking about low-level or built-in exceptions. > I was talking about using exceptions in my programming where often the > function is reasonably confident of the kind of errors it is likely to > incur. I did not start this as a criticism of Python's exceptions as > such. I just expressed my personal aversion to using them in my own code. > > However, in my next project I have started using exceptions and will keep > an open mind on how it turns out. So far it doesn't seem too bad. Open minds are good. -- D'Arcy J.M. Cain <da...@druid.net> | Democracy is three wolves http://www.druid.net/darcy/ | and a sheep voting on +1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner. -- http://mail.python.org/mailman/listinfo/python-list