What is the most efficient way of applying a function to all the elements of
an iterable while discarding the
result (i.e. operations are done only for side-effects).

For example if I want to save all elements in a list of items (and am not
interested in what save() returns), the
simplest way is:

itemlist = [i1, i2, i3....]
for item in itemlist: item.save()

It might be squeezing too much but is it possible to do it more efficiently
by pushing the looping inside the C code
and achieve some gains as is done by using map in place of a for loop when
the return values need to be saved?

Any suggestions will be appreciated.

TIA

-- 
Regards
Shashank Singh
Senior Undergraduate, Department of Computer Science and Engineering
Indian Institute of Technology Bombay
shashank.sunny.si...@gmail.com
http://www.cse.iitb.ac.in/~shashanksingh
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to