[Python-Dev] Syntax for "except"
Greg Ewing
greg at cosc.canterbury.ac.nz
Tue Feb 10 19:19:32 EST 2004
"Edward C. Jones" <edcjones at erols.com>:
> Why was Python syntax designed so
> except (TypeError, ValueError):
> is OK but
> except [TypeError, ValueError]:
> is forbidden.
My guess would be that exception matching needs to be fast, so
special-casing for tuples is desirable, and allowing more general
sequences as well would add so little utility that it's not considered
worth the extra code.
Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury, | A citizen of NewZealandCorp, a |
Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. |
greg at cosc.canterbury.ac.nz +--------------------------------------+
More information about the Python-Dev
mailing list