En Wed, 01 Jul 2009 12:49:31 -0300, Scott David Daniels
<scott.dani...@acm.org> escribió:
Gabriel Genellina wrote:
...
def convert(in_queue, out_queue):
while True:
row = in_queue.get()
if row is None: break
# ... convert row
out_queue.put(converted_line)
These loops work well with the two-argument version of iter,
which is easy to forget, but quite useful to have in your bag
of tricks:
def convert(in_queue, out_queue):
for row in iter(in_queue.get, None):
# ... convert row
out_queue.put(converted_line)
Yep, I always forget about that variant of iter() -- very handy!
--
Gabriel Genellina
--
http://mail.python.org/mailman/listinfo/python-list