Paul Graham on Python hackers

Bryan Olson bryanjugglercryptographer at yahoo.com
Tue Aug 10 14:58:09 EDT 2004


beliavsky at aol.com wrote:
> I don't know enough about functional programming (FP) to argue. David
> Mertz wrote some articles on FP in Python -- see
> http://www-106.ibm.com/developerworks/library/l-prog.html .

If you've never looked at a real FP language, I recommend it. 
Mertz is trying to convey the flavor of functional programming 
to people who know Python.  He doesn't suggest writing non-
trivial programs that way.  He notes at the end, "I've found it 
much easier to get a grasp of functional programming in the 
language Haskell than in Lisp/Scheme."


Incidentally, Mertz's 'Equivalent "short circuit" expression',

   (<cond1> and func1()) or (<cond2> and func2()) or (func3())

isn't really right.  If cond is true and func1() returns a false 
value, it will go on to evaluate cond2 and so on.  We could use:

  (<cond1> and [func1()]) or (<cond2> and [func2()]) or ([func3()])[0]

Or maybe:

   (<cond1> and func1) or (<cond2> and func2) or (func3))()


-- 
--Bryan



More information about the Python-list mailing list