Mercurial > public > think_complexity
view ch2ex7.py @ 24:5c2c4ce095ef
A stab at the L(p)/L(0) plot.
I still don't quite get how the graphs in the Watts and Strogatz paper were
generated. My results have basically the same shape, but don't converge to 0.
I'm not sure how this is possible if the rewire function does not remove edges.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Thu, 03 Jan 2013 18:41:13 -0600 |
parents | aea27d10dd18 |
children |
line wrap: on
line source
"""Chapter 2.7, exercise 7. Write a generator that yields an infinite sequence of alpha-numeric identifiers, starting with a1 through z1, then a2 through z2, and so on. """ import string def generate_identifier(): num = 1 while True: for c in string.lowercase: yield c + str(num) num += 1 if __name__ == '__main__': try: for name in generate_identifier(): print name except KeyboardInterrupt: print "Control-C interrupt"