On 7/26/2012 2:39 AM, Ulrich Eckhardt wrote:

I have seen code that just created a list comprehension to iterate over
something but was discarding the results.

If you mean, discard the resulting list, that is probably bad code as it should not create the list in the first place. A generator expression or for loop will iterate without creating an unneeded list.

> That could be a case for a "do nothing" function.

Such code does do something within the comprehension.

Just having a function that does nothing

Not possible. None is the default return. Python does not have proceedures, and that is not going to change, especially for a null proceedure.

--
Terry Jan Reedy



--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to