Python Solution for Project Euler #2 (Fibonacci Sums)
I would use separately Fibonacci generator

def even_fib(limit):
    a, b = 0, 1
    while a &lt; limit:
        if not a % 2:         
            yield a
        a, b = b, a + b


And sum function to calculate sum of items

print sum(even_fib(4000000))