functional programming

Moshe Zadka moshez at math.huji.ac.il
Wed Feb 23 01:44:21 EST 2000


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?
--
Moshe Zadka <mzadka at geocities.com>. 
INTERNET: Learn what you know.
Share what you don't.





More information about the Python-list mailing list