On Thu, 4 Mar 2010 21:57:18 +0100
Andreas Kostyrka <[email protected]> wrote:
I would rather write it:
> x_it = iter(x) # get an iterator for x
> try:
> while True:
> i = x_it.next()
> print i
> except StopIteration:
> pass
x_it = iter(x) # get an iterator for x
while True:
try:
i = x_it.next()
except StopIteration:
break
else:
print i
(The trial is about getting each new element. The exception breaks the loop.
But maybe it's only me.)
Denis
--
________________________________
la vita e estrany
spir.wikidot.com
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor