#!/usr/local/bin/python # $Id: hash2.python,v 1.2 2001/05/06 19:16:31 doug Exp $ # http://www.bagley.org/~doug/shootout/ # from Mark Baker import sys n = int(sys.argv[1]) hash1 = {} for i in xrange(10000): hash1['foo_' + `i`] = i hash2 = {} for i in xrange(n): for k in hash1.keys(): try: hash2[k] += hash1[k] except KeyError: hash2[k] = hash1[k] print hash1['foo_1'], hash1['foo_9999'], hash2['foo_1'], hash2['foo_9999']