[Python-Dev] PEP 275: "Switching on Multiple Values", Rev 1.1
Jack Jansen
jack@oratrix.nl
Tue, 13 Nov 2001 15:32:55 +0100
Even though I'm not sure I like the switch idea (and I won't even contemplate
how Guido will react when he comes back and sees what we've been spending our
time on:-) there's one very special case of switch that I would like, and
that's the Algol 68 style switch on type. If we had something like
def foo(x):
switch type(x):
case int:
do something
case string:
do something else
this would be a nice point to hook into for something that tries to compile
Python to C or somesuch.
Hmm, you would probably need a tuple-based switch as well:
switch type(x), type(y):
case int, int:
....
--
Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++
Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++
www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm