[Tutor] Are you allowed to shoot camels? [kinda OT]

Alan Gauld alan.gauld at freenet.co.uk
Fri Feb 4 00:28:36 CET 2005


> Perl and Python both resist the introduction of a switch statement 
> which I (and many others) feel is the most elegant way to express 
> what it does.

Interesting. What do you feel is the problem with elif?
Its not even much more typing and allows for much more 
expressive test conditions. Switch is really only useful 
for a single subset of tests. And of course switch statements 
are notorious bug factories and maintenance nightmares - 
the reason why OOP tries to eliminate them wherever possible.

> I also wish Python would take up the C ternary operator 
> which is also quite clear and elegant.

:-)
You joke I assume? ':?' is clear? Its succinct but also 
prone to abuse. I don't think the Python equivalent 

foo = x and y or z


is much less elegant than

foo = x ? y : z

> ... To paraphrase the famous quote:  There are no good programming
languages, just some that aren't as bad in some situations.

Absolutely true.
I still use assembler occasionally, and I even like bits of COBOL
(although not much, its my least favourite language!). And probably 
my favourite language of all is Logo even though I've never used 
it for any serious projects.

Alan G.


More information about the Tutor mailing list