Exception handling wart in Python

seb seb at tesco.net
Fri Nov 2 19:59:15 EST 2001


On Fri, 2 Nov 2001 08:42:42 -0500, "Steve Holden"
<sholden at holdenweb.com> wrote:

>"Leo Lipelis" <aeoo at myspamrealbox.com> wrote ...
>[...]
>> This is also nonsense.  Sure you can catch all exceptions and examine
>them.
>> But in order to code anything intelligent, you again have to know ahead of
>> time what these exceptions might be.  At the very *LEAST* you need a list
>> of *all possible* exceptions in an entire Python code base, including
>> Python standard module library!  But how much better would it be if you
>> could narrow the scope to the most likely exceptions.
>>
>Presumably all Python written to date is therefore "non-intelligent"? Sounds
>to me like you've got a project on your hands. Unless you're just bitching
>about this because you think somebody else will "fix" it if you make enough
>noise.
>

<snip stuff>

>
>    print open("anyoldfile.txt", "r").read()
>
>because open can raise several exceptions which this statement fails to
>handle. Yup, that's horseshit all right. Just as a matter of interest, what
>would be your "approved" alternative for the above one-liner? Sorry if my
>response comes off as aggressive, which isn't in the spirit of this
>newsgroup. I'm actually trying to teach you something here!
>
>didn't-realise-i-cared-so-much-ly y'rs  - steve
>--
>http://www.holdenweb.com/
>

okay, to be technically correct this is about return codes rather than
exceptions, but in the spirit...

http://www.jsquared.co.uk/jennyl/verity.htm

The quite excellent Verity Stob (and her sister Parity) -ly.

seb.




More information about the Python-list mailing list