This is how I usually do fibonacci:
def F(n):
a = 0
b = 1
for i in range(n):
a,b = b,a+b
return a
This is the one-liner equivalent:
F = lambda n : reduce(lambda a,dummy: (a[1],sum(a)), [(0,1)] + range(n))[0]
Some output:
>>> map(F, [0, 1, 2, 3, 100, 200])
[0, 1, 1, 2, 354224848179261915075L, 280571172992510140037611932413038677189525L]
PS: I have some code lying around somewhere that uses gmp to compute really large values of the fibonacci sequence in C. At the time I wrote it, I tested 3 versions of the same code C/gmp python/int and Java/BigInteger. As far as speed goes, taking the C implementation as reference, they ran something like this(more is worse):
C/gmp: 1x
python/int: 2x
Java/BigInteger: ~4x
I don't know if the java bigint implementation has improved since, but apparently the default int class of python is pretty damn performant