[Python-Dev] Switch statement
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