js: > crange = lambda c1, c2: [ chr(c) for c in range(ord(c1), ord(c2)+1) ] > ''.join(chr(c) for c in crange('a', 'z') + crange('A', 'Z'))
Yes, managing char ranges is a bit of pain with Python. You can also pack those chars: xcrange = lambda cc: (chr(c) for c in xrange(ord(cc[0]), ord(cc[1]) +1)) But I don't like that much. The calls: ''.join(xcrange('az')) + ''.join(xcrange('AZ')) But note that you return the last item of the range too, and that goes against the semantic of the usual Python range/xrange, so you may want to call this function with another name. Maybe there are better ways to solve this problem. Maybe a way to generate (closed?) char ranges can be added to the Python standard lib. Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list