On Mon, Dec 22, 2014 at 8:21 PM, Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> wrote: > If the called function has side-effects, a list comp is not a good solution.
Hmm. I'm not so sure about that. Side effects are fine in a list comp, as long as you're making use of the return values. For instance, if you have a function that inserts a record to a database and returns the new ID, you could reasonably use a list comp to save a bunch of records and get a list of IDs for subsequent use. ChrisA -- https://mail.python.org/mailman/listinfo/python-list