[Python-Dev] Switch statement

Greg Ewing greg.ewing at canterbury.ac.nz
Mon Jun 12 03:06:41 CEST 2006


skip at pobox.com wrote:

> I agree, but that of course limits the expressions to constants which can be
> evaluated at compile-time as I indicated in my previous mail.

A way out of this would be to define the semantics so that
the expression values are allowed to be cached, and the
order of evaluation and testing is undefined. So the first
time through, the values could all be put in a dict, to
be looked up thereafter.

--
Greg


More information about the Python-Dev mailing list