hello, i have a small function which mimics binary counting. it runs fine as long as the input is not too long, but if i give it input longer than 8 characters it gives
RuntimeError: maximum recursion depth exceeded in cmp i'm not too sure what i am doing improperly. is there really a lot of recursion in this code? ================== import sys def ch4(item, n=0): if n < len(item): if item[n] == '0': item[n] = '1' print ''.join(item) ch4(item) elif item[n] == '1': item[n] = '0' ch4(item, n+1) ch4(list(sys.argv[1])) ================== this function expects input in the form of a string of zeros, like this: python test-bin.py 00000000 and is expected to output a list of permutations like this: $ python test-bin.py 0000 1000 0100 1100 0010 1010 0110 1110 0001 1001 0101 1101 0011 1011 0111 1111 thanks for all help! sincerely, proctor -- http://mail.python.org/mailman/listinfo/python-list