[Python-Dev] PEP 0424: A method for exposing a length hint

Christian Heimes lists at cheimes.de
Sun Jul 15 16:33:23 CEST 2012


Am 15.07.2012 16:22, schrieb Antoine Pitrou:
> On Mon, 16 Jul 2012 00:08:41 +1000
> Nick Coghlan <ncoghlan at gmail.com> wrote:
>> Right, I agree on the value in being able to return something to say "this
>> cannot be converted to a concrete container".
> 
> Who would be able to return that, apart from trivial cases like
> itertools.cycle()?

For example most numerical sequence iterators like Fibonacci generator,
prime number sequence generator and even trivial cases like even natural
number generator. IMO it's a good idea to have a notation for infinitive
iterators that can't be materialized as finite containers.

+1

Christian



More information about the Python-Dev mailing list