On 21-Mar-07, at 5:29 PM, Baishampayan Ghose wrote:
but then you would need to raise CreditRedirectionError somewhere
- too
much work for doubtful gains - not pythonish
Well, no matter what the programming language is, catching all exceptions _is_ a bad idea. I don't think what you mean by being ``pythonish'', but if you mean ``pythonic'', I don't see how it is related. See [1] for more. Catching all exceptions are only good if you re-raise them at some point of time [2]. I may be a n00b, but Ian Bicking is certainly not one. And `import this' for the Zen of Python.
i dont think you are right here. What Ian Bicking is talking about is when you do something specific depending on the exception raised - which would go wrong if the exception was not the expected one. In this case, the except clause just executes a print statement - which wont screw up the program no matter what the real error was. So whether to catch all exceptions or not depends on the program. Your CreditRedirectionError is a catch-all error anyway as it doesnt specifiy why the redirection didnt work - so the end result is the same whether you use it or not. On the other hand, if you wanted to find out why the redirection failed and take appropriate action for each of the possible scenarios, then you would have to raise various errors like: RoshanDoesNotExistError, RoshanNotAtHomeError, etc etc. In this case your point is valid. But the simple case covered here does not require this granularity, hence providing pseudo-granularity is un-pythonish (or un-pythonic).
Incidently, if *you* are a n00b - what does that make me?