import getopt import os import sys import threading #fibonacci sequence element n, the slow way def fibonacci(n): if n <= 1: return 1 else: return fibonacci(n - 1) + fibonacci(n - 2) def print_fibonacci(max_n): for i in range(max_n): print fibonacci(i) def run_child(): os.system('python2.2 fibonacci.py -c > fibonacci.txt') def am_child(): opts, args = getopt.getopt(sys.argv[1:], 'c') return not not opts if not am_child(): threading.Thread(target = run_child).start() print_fibonacci(100)