functional programming

Aahz Maruch aahz at
Wed Feb 23 18:05:34 CET 2000

In article <Pine.GSO.4.10.10002230843360.689-100000 at sundial>,
Moshe Zadka  <mzadka at> wrote:
>On 22 Feb 2000, Aahz Maruch wrote:
>>>Functional programming has a very clear definition: no side
>>>effects. Iterating explicitly means "with side effects." I'm not saying
>>>one style is better then the other, but you *can't* program functionally
>>>in Python. I had to get over it, and learn to write fibonaci with a while
>>>loop, when I first got to Python.
>> <blink><blink>  What do you call this:
>> def fib(x):
>>   if x != int(x):
>>     raise "Must use an integer"
>>   if x < 0:
>>     raise "Must be > 0"
>>   if x == 0 or x == 1:
>>     return 1L
>>   else:
>>     return fib(x-1) + fib(x-2)
>Um.....the most inefficienct version of fibonacci I've ever seen?

Well, sure, but it meets your definition of functional programming.  You
claimed that functional programming is impossible in Python; I've
provided a counter-example.  Do you now retract your claim?
                      --- Aahz (Copyright 2000 by aahz at

Androgynous poly kinky vanilla queer het    <*>
Hugs and backrubs -- I break Rule 6

Love does not conquer all.  Humans are extremely flexible, usually more
flexible than we're willing to admit.  But some flexibility comes at a
cost, and sometimes that cost is more than we can bear.

More information about the Python-list mailing list