[Python-ideas] Fwd: New suggested built in keyword: do

Jacco van Dorp j.van.dorp at deonet.nl
Fri Jun 8 10:58:19 EDT 2018


Given that an exhaust method for generators didn't make it, I dont
think a keyword has more chance. For reference, that exhaust method
would have looked like:

(print (x) for x in range(50)).exhaust()

and be defined as:

def exhaust(self):
    for _ in self:
       pass

Also, there was some more involved method that did it in less
characters, having to do with queues of length 0 or something.


More information about the Python-ideas mailing list