iters on ints? (reducing the need for range/xrange)
Toby Dickenson
tdickenson at devmail.geminidataloggers.co.uk
Mon Nov 12 07:29:21 EST 2001
Paul Rubin <phr-n2001d at nightsong.com> wrote:
>"Tim Peters" <tim.one at home.com> writes:
>> > for i in 10:
>> > doSomething(i)
>> >...
>> This isn't even half as disgusting as most people will say it is <wink>. I
>> rather like it! Write a PEP.
>
>The trouble is as someone else noted, "for i in 10" replaces "for i in
>range(10)". But how do you handle range(1,10)? "for i in 1,10" does
>precisely the wrong thing.
for i in 10-1:
;-)
Toby Dickenson
tdickenson at geminidataloggers.com
More information about the Python-list
mailing list