[Python-Dev] Syntax for "except"
Guido van Rossum
guido at python.org
Tue Feb 10 11:51:09 EST 2004
> Why was Python syntax designed so
> except (TypeError, ValueError):
> is OK but
> except [TypeError, ValueError]:
> is forbidden. Should this be changed? Is immutability needed here? Where
> in Python is immutability really needed or really improves efficiency?
I never *intended* this to be seen as a container, but rather as a use
of parentheses for grouping.
If I were to revise the syntax, I would probably change it around
completely to avoid the common mistake of writing
except TypeError, ValueError: ...
(but I don't have a proposal).
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-Dev