# HG changeset patch
# User Brian Neal <bgneal@gmail.com>
# Date 1354585763 21600
# Node ID aea27d10dd188fdb108826d6ee26c34654167192
# Parent  9f1fccc1399104b77687e57015edc8deab28926b
Chapter 2.7, exercise 7; a generator to create identifiers.

diff -r 9f1fccc13991 -r aea27d10dd18 ch2ex7.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ch2ex7.py	Mon Dec 03 19:49:23 2012 -0600
@@ -0,0 +1,22 @@
+"""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"