Message251324
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. |
|
Date |
User |
Action |
Args |
2015-09-22 15:08:36 | jneb | set | recipients:
+ jneb |
2015-09-22 15:08:36 | jneb | set | messageid: <1442934516.43.0.38615635977.issue25215@psf.upfronthosting.co.za> |
2015-09-22 15:08:36 | jneb | link | issue25215 messages |
2015-09-22 15:08:36 | jneb | create | |
|