[Python-Dev] Switch statement (original) (raw)

Eric Sumner kd5bjo at gmail.com
Fri Jun 23 20:02:11 CEST 2006


On 6/22/06, Guido van Rossum <guido at python.org> wrote:

(3) A switch is implemented using a dict which is precomputed at the same time its static expressions are precomputed. The switch expression must be hashable. Overlap between different cases will raise an exception at precomputation time.

How does this interact with contains, len, and iter for the 'case in S' statement? Would it work with a class that only implements contains, such as a continuous range class?

-- Eric Sumner



More information about the Python-Dev mailing list