why no "do : until"?
Aahz Maruch
aahz at panix.com
Tue Jan 9 02:46:33 EST 2001
In article <6fz66.4202$AH6.740364 at newsc.telia.net>,
Fredrik Lundh <fredrik at effbot.org> wrote:
>
> i = 0
> for x in a:
> ...
> i += 1
>
>(like Aahz, I prefer the second variant. it's slightly faster on
>large sequences, and doesn't depend on len(a) returning the
>right thing)
It's also guaranteed to consume no extra memory beyond that needed to
store x and i (and the already-allocated a).
--
--- Aahz (Copyright 2001 by aahz at pobox.com)
Androgynous poly kinky vanilla queer het <*> http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6
Sometimes, you're not just out of left field, you're coming in all the
way from outer space. --Aahz
More information about the Python-list
mailing list