$10K coding deathmatch

Jonathan Ellis jonathan at carnageblender.com
Sat Nov 4 11:14:02 MST 2006


On Fri, 3 Nov 2006 18:14:43 -0700, "Levi Pearson" <levi at cold.org> said:
> Clearly, breaking the steps out into intermediate calculations makes  
> it look a little cleaner, but it doesn't really change the syntax  
> used (aside from adding variable assignment syntax, which is rather  
> non-functional).  Python doesn't have the ternary operator (what I  
> called a conditional expression).  This means you pretty much have to  
> use and/or for inline conditionals, as far as I know.

you can do this with boolean operators in early python versions

a = condition and trueval or falseval

this doesn't quite work if trueval happens to evaluate to false, so in
python 2.5 you can write

a = trueval if condition else falseval

> What this boils down to is that Python isn't terribly friendly to a  
> functional programming style, even though it has a lot of the  
> features that make it possible.

No, python is its own creature, not a lisp wannabe. :)

-Jonathan
-- 
C++ is history repeated as tragedy. Java is history repeated as farce.  --Scott McKay




More information about the PLUG mailing list