Unicode error

Benjamin Kaplan benjamin.kaplan at case.edu
Fri Jul 23 18:04:46 EDT 2010


On Fri, Jul 23, 2010 at 2:46 PM, Nobody <nobody at nowhere.com> wrote:
> On Fri, 23 Jul 2010 10:42:26 +0000, Steven D'Aprano wrote:
>
>> Don't write bare excepts, always catch the error you want and nothing
>> else.
>
> That advice would make more sense if it was possible to know which
> exceptions could be raised. In practice, that isn't possible, as the
> documentation seldom provides this information. Even for the built-in
> classes, the documentation is weak in this regard; for less important
> modules and third-party libraries, it's entirely absent.
>

You still don't want to use bare excepts.People tend to get rather
annoyed when you handle KeyboardInterrupts and SystemExits like you
would a UnicodeError. Use Exception if you don't know what exceptions
can be raised.



More information about the Python-list mailing list