[Python-Dev] Bare except clauses in PEP 348

James Y Knight foom at fuhm.net
Thu Aug 25 06:45:12 CEST 2005

On Aug 24, 2005, at 9:39 PM, Brett Cannon wrote:
> On 8/24/05, Guido van Rossum <gvanrossum at gmail.com> wrote:
>> On 8/24/05, James Y Knight <foom at fuhm.net> wrote:
>>> I think it must be the case that raising an object which does not
>>> derive from an exception class must be deprecated as well in order
>>> for "except:" to be deprecated. Otherwise, there is nothing you can
>>> change "except:" to in order not to get a deprecation warning and
>>> still have your code be correct in the face of documented  
>>> features of
>>> python.
>> I agree; isn't that already in ther PEP? This surely has been the
>> thinking all along.
> Requiring inheritance of BaseException in order to pass it to 'raise'
> has been in the PEP since the beginning.

Yes, it talks about that as a change that will happen in Python 3.0.  
I was responding to

>> OK, I'm convinced. Let's drop bare except for Python 3.0, and
>> deprecate them until then, without changing the meaning.

which is talking about deprecating bare excepts in Python 2.5. Now  
maybe it's the idea that everything that's slated for removal in  
Python 3.0 by PEP 348 is supposed to be getting a deprecation warning  
in Python 2.5, but that certainly isn't stated. The transition plan  
section says that all that will happen in Python 2.5 is the addition  
of "BaseException".


More information about the Python-Dev mailing list