On Fri, Aug 22, 2008 at 6:44 PM, defn noob <[EMAIL PROTECTED]> wrote:
> def letters():
>        a = xrange(ord('a'), ord('z')+1)
>        B = xrange(ord('A'), ord('Z')+1)
>        while True:
>                yield chr(a)
>                yield chr(B)
>
>
> TypeError: an integer is required

No. The problem is that "chr function" receives "int"
"a" and "B" are generators of "int" items.

What exactly you intent with that code?

Maybe:
#<code>
def letters():
   for i in xrange(ord('a'), ord('z')+1):
       yield chr(i)
   for i in xrange(ord('A'), ord('Z')+1):
       yield chr(i)

for letter in letters():
   print letter
#</code>

Regards
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to