On Wed, 21 Jun 2006, Phillip J. Eby wrote:
> Well, EIBTI and all that:
>
> switch x:
> case == 1: foo(x)
> case in S: bar(x)
>
> It even lines up nicely. :)
Hmm, this is rather nice. I can imagine possible use cases for
switch x:
case > 3: foo(x)
case is y: spam(x)
case == z: eggs(x)
An interesting use case for which this offers no corresponding
syntax is
case instanceof ClassA: ham(x)
which doesn't work because Python spells a type test as
isinstance(a, b) rather than with an operator. (I suppose
whether we want it to be an operator might be another
question to think about for Python 3000.)
-- ?!ng
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com