[Python-Dev] PEP 352 Transition Plan

François Pinard pinard at iro.umontreal.ca
Sat Nov 5 17:29:49 CET 2005


[Guido van Rossum]

> I've made a final pass over PEP 352, mostly fixing the __str__, 
> __unicode__ and __repr__ methods to behave more reasonably. I'm all 
> for accepting it now. Does anybody see any last-minute show-stopping 
> problems with it?

I did not follow the thread, so maybe I'm out in order, be kind with me.

After having read PEP 352, it is not crystal clear whether in:

    try:
        ...
    except:
        ...

the "except:" will mean "except BaseException:" or "except Exception:".
I would except the first, but the text beginning the section titled 
"Exception Hierarchy Changes" suggests it could mean the second, without
really stating it.

Let me argue that "except BaseException:" is preferable.  First, because 
there is no reason to load a bare "except:" by anything but a very 
simple and clean meaning, like the real base of the exception hierarchy.  
Second, as a bare "except:" is not considered good practice on average, 
it would be counter-productive trying to figure out ways to make it more 
frequently _usable_.

-- 
François Pinard   http://pinard.progiciels-bpi.ca


More information about the Python-Dev mailing list