[issue25215] Simple extension to iter(): iter() returns empty generator

2015-09-22 Thread Brett Cannon
Brett Cannon added the comment: I agree with Raymond. Allowing a non-argument iter() runs the risk of someone messing up and forgetting the arguments and yet having no error that they did so. And considering how easy it is to get an iterator of an empty list or tuple I don't see a benefit.

[issue25215] Simple extension to iter(): iter() returns empty generator

2015-09-22 Thread Jurjen N.E. Bos
New submission from Jurjen N.E. Bos: 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

[issue25215] Simple extension to iter(): iter() returns empty generator

2015-09-22 Thread Zachary Ware
Changes by Zachary Ware : -- versions: -Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5 ___ Python tracker ___

[issue25215] Simple extension to iter(): iter() returns empty generator

2015-09-22 Thread Raymond Hettinger
Raymond Hettinger added the comment: I'm not sure that python needs a neater way to make an empty generator. It isn't a common use case and there isn't anything wrong with iter([]). There are downsides to expanding an API. It creates yet another thing to learn and remember. Even now, few