[Python-Dev] Re: Extended Function syntax

Paul Moore lists@morpheus.demon.co.uk
Sun, 02 Feb 2003 16:55:25 +0000


Guido van Rossum <guido@python.org> writes:

> Hmm, you could even craft your own case statement with his
> suggestion:
>
>   switch(expr):
>     case(val1):
>       block1
>     case(val2):
>       block2
>     default:
>       block3
>
> This actually makes me worry -- I didn't plan thunks to be the answer
> to all problems.  A new idea that could cause a paradigm landslide is
> not necessarily right.

I can see your reservations here. But I'm not sure I share them. A new
idea that can be misused isn't necessarily wrong, either...

[And I don't know that I see this as "misuse" in any case.]

To be honest, the fact that people *can* implement switch statements
using this feature doesn't mean that they will. And even if they do,
it doesn't mean that the implementation will be used. After all,
people could do some pretty scary things with the bytecodehacks
module, if they wanted to...

The obvious issues are dependency on an extra module, and performance.
And even if a switch module was available, you'd need to import from
it if you wanted to use the construct, so you'd presumably be aware of
what you were getting.

It's just a new tool in the toolbox. When you first get a hammer,
everything looks like a nail for a while, but after a bit you get a
sense of perspective again.

Paul.
-- 
This signature intentionally left blank