[Python-ideas] "While" suggestion
Arnaud Delobelle
arnodel at googlemail.com
Thu Jul 3 23:20:19 CEST 2008
On 3 Jul 2008, at 22:01, Chris Rebert wrote:
> Purely for the sake of completeness:
>
> #while True idiom (current Python)
> while True:
> number = random.randint(1, 100)
> if number not in picked_numbers:
> break
And even more completeness :)
#iter idiom
def rand100():
random.randint(1, 100)
for number in iter(rand100, None):
if number not in picked_numbers:
break
--
Arnaud
More information about the Python-ideas
mailing list