This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jneb
Recipients jneb
Date 2015-09-22.15:08:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1442934516.43.0.38615635977.issue25215@psf.upfronthosting.co.za>
In-reply-to
Content
When looking for a "neat" way to create an empty generator, I saw on stackOverflow that the crowd wasn't sure what was the "least ugly" way to do it.
Proposals where:
def emptyIter(): return; yield
or
def emptyIter(): return iter([])

Then it struck me that a trivial extension to the iter() built-in would be to allow to call it without arguments, thus giving a simple to understand empty iterator, and allowing:
def emptyIter(): return iter()
(And, of course, this function would not need to exist in any reasonable program in that case.)

The implementation would be trivial, I assume.
History
Date User Action Args
2015-09-22 15:08:36jnebsetrecipients: + jneb
2015-09-22 15:08:36jnebsetmessageid: <1442934516.43.0.38615635977.issue25215@psf.upfronthosting.co.za>
2015-09-22 15:08:36jneblinkissue25215 messages
2015-09-22 15:08:36jnebcreate