[Python-Dev] Bare except clauses in PEP 348
Guido van Rossum
gvanrossum at gmail.com
Thu Aug 25 07:13:09 CEST 2005
On 8/24/05, James Y Knight <foom at fuhm.net> wrote:
> 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".
Then maybe the PEP isn't perfect just yet. :-)
It's never too early to start deprecating a feature we know will
disappear in 3.0.
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-Dev