On Dec 10, 2009, at 12:56 PM, Mike Samuel wrote:
Generators compose in some ways though the syntax can be awkward: def zip(a, b): for a_el in a: yield (a_el, b.next()) try: b.next() except StopIteration: pass except: raise AssertionError('%r not exhausted', b)Sorry, zip should probably just read def zip(a, b): for a_el in a: yield (a_el, b.next()) b.next()
Right -- it really is quite rare to have to catch StopIteration. If you feel the need, something else may be going on that needs addressing at a higher level.
/be _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

