On 07/11/2020 09:16 PM, Rob Cliffe via Python-ideas wrote:
My gut feeling (backed by no evidence) is that dealing with the case of zero iterations is not needed frequently enough to cater for it.
My personal experience is that the case of no iterations is frequent enough, and a big enough pain to deal with, that if we're making changes we should include a way to deal with it. Currently:
if empty_iterable: # do whatever else: for it in iterable: # do something
obj = object for obj in some_iterator: do_stuff() if obj is object: # iterator was empty do_different_stuff()
for obj in iterator: do_stuff elif empty: do_other_stuff()
would be much nicer.