try..except with empty exceptions
Serhiy Storchaka
storchaka at gmail.com
Sat Apr 11 04:22:15 EDT 2015
On 11.04.15 10:11, Steven D'Aprano wrote:
> Anyway, in modern Python (2.6 onwards), now that string exceptions are gone,
> you can supply something to catch everything. Or nothing, for that matter:
>
> BaseException # catch everything
Not everything.
>>> class A: pass
...
>>> try: raise A
... except BaseException: pass
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
__main__.A: <__main__.A instance at 0xb707982c>
More information about the Python-list
mailing list