Will McGugan wrote:
> Neal Becker wrote:
> 
>> I can do this with a generator:
>>
>>     def integers():
>>         x = 1
>>         while (True):
>>             yield x
>>             x += 1
>>
>> for i in integers():
>> Is there a more elegant/concise way?
>>
> 
> import itertools
> for i in itertools.count():
>     print i
> 

Actualy itertools.count(1) to start at 1..

Will McGugan
-- 
http://www.willmcgugan.com
"".join({'*':'@','^':'.'}.get(c,0) or chr(97+(ord(c)-84)%26) for c in 
"jvyy*jvyyzpthtna^pbz")
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to