A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-March/062583.html below:

[Python-Dev] GeneratorExit inheriting from Exception

[Python-Dev] GeneratorExit inheriting from Exception [Python-Dev] GeneratorExit inheriting from ExceptionGiovanni Bajo rasky at develer.com
Sat Mar 18 19:32:36 CET 2006
Georg Brandl <g.brandl at gmx.net> wrote:

>> Exception
>> +- KeyboardInterrupt
>> +- GeneratorExit
>> +- SystemExit
>> +- StopIteration
>> +- Error
>>>  +- ImportError
>>>  +- (etc.)
>>>
>> +- Warning
>>    +- UserWarning
>>    +- (etc.)
>
> Cool! That's so far the clearest solution. An additional bonus is that
> except
> statements look nicer:
>
> except:            # still catches all Exceptions, just like
> except Exception:
>
> except Error:      # is what you normally should do

+1 on the general idea, I just don't specifically like that "except:" is the
"wrong" thing to do: part of the PEP352 idea was that people writing
"except:" out of ignorance would still not cause their program to intercept
KeyboardInterrupt, or StopIteration.

Unless this new proposal also includes changing the meaning of "except:" to
"except Error". Also, under this new proposal, we could even remove
Exception from the builtins namespace in Py3k. It's almost always wrong to
use it, and if you really really need it, it's spelled exceptions.Exception.
-- 
Giovanni Bajo

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4