I'm coming from Tcl-world ...

Andrae Muys amuys at shortech.com.au
Sun Aug 4 21:24:21 EDT 2002


Tim Daneliuk <tundra at tundraware.com> wrote in message news:<io9fia.75f.ln at eskimo.tundraware.com>...
> brueckd at tbye.com wrote:
> > 
> > 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?

Agreed.

We already have polymorphic objects which provide a cleaner approach
to the vast majority of traditional switch statements.  For the few
that remain, I find an indexed function table approach (generally
using dictionaries, sometimes lists) a far more elegant approach.

In the case of varying conditionals, an if/elif/else chain is hardly
less consise then a switch.

In other words, I don't perceive any advantage to be gained through
introducing a switch statement, except maybe to discourage the use of
cleaner approaches.

> (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)

Definately agreed.

Andrae Muys



More information about the Python-list mailing list