[Python-Dev] Py3k: Except clause syntax

Michael Urman murman at gmail.com
Thu Mar 16 15:57:37 CET 2006


On 3/16/06, Georg Brandl <g.brandl at gmx.net> wrote:
> +1. Fits well with the current use of "as".

I like it, but wonder about the false parallels below. My initial
reaction is it's not worth worrying about as it's easy to learn as
part of the import or except statements, and should do the right
thing. Nobody would expect the second import to rename both items to
q, and the first except clause would be a SyntaxError.

    from foo import bar as b, quux as q
    except TypeError as te, IndexError as ie

    from foo import bar, quux as q
    except TypeError, IndexError as e

Michael
--
Michael Urman  http://www.tortall.net/mu/blog


More information about the Python-Dev mailing list