[Python-Dev] Tricky way of of creating a generator via a comprehension expression (original) (raw)

Ivan Levkivskyi levkivskyi at gmail.com
Wed Nov 22 11:43:35 EST 2017


Sorry, forgot some details in the second "definition":

 try:
     def __gen():
         for i in range(3):
             yield (yield i)
     g = list(__gen())
 finally:
     del __gen

-- Ivan -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20171122/b495505d/attachment-0001.html>



More information about the Python-Dev mailing list