#!/usr/bin/env python def fib(x): if x <= 1: return x else: return fib(x-1) + fib(x-2) def main(): for x in range(0,30): print fib(x) if __name__ == '__main__': import cProfile cProfile.run('main()', 'demo.prof')