I'm coming from Tcl-world ...
Tim Daneliuk
tundra at tundraware.com
Fri Aug 2 21:00:02 EDT 2002
brueckd at tbye.com wrote:
> On Fri, 2 Aug 2002, Tim Daneliuk wrote:
>
>
>>Martin v. Löwis wrote:
>>
>>
>>>>2.) A 'switch'-thing: like a big if-elif-elif-elif-...-else but
>>>>which evaluates its expression only once ... and then does all the
>>>>comparisons.
>>>
>>>
>>>PEP 275 proposes to include such a thing. You are encouraged to
>>>comment on the PEP, either in this group, or by contacting the PEP
>>>author:
>>>
>>>http://www.python.org/peps/pep-0275.html
>>>
>>
>>This seems to me to just be syntactic sugar and thus unneeded.
>
> [snip]
>
> Yeah, but being syntactic sugar doesn't necessarily make something a bad
> idea. That's like saying you don't need for-loops since we have
> while-loops. Heck, since we have operator.mul we don't need '*' anymore.
> ;-)
>
>
Clearly, minimalism can be taken to a ridiculous extreme. But, I still fail
to see what problem adding switch-case syntax fixes. It is certainly not
more compact than a dictionary approach AFAIKT, and it is (arguably) no clearer,
so why add more sugar here?
(Then again, I am fond of table (dictionary)-driven constructs because
they are, IMHO, much more maintainable and clear than the equivalent
in-line implementations... I'm a wee bit biased)
--
------------------------------------------------------------------------------
Tim Daneliuk
tundra at tundraware.com
More information about the Python-list
mailing list