[issue33939] Raise OverflowError in __length_hint__ for consistently infinite iterators

2018-06-23 Thread Raymond Hettinger
Raymond Hettinger added the comment: Perhaps an object can set an attribute, __infinite_iterator__ = True. That would provide an unequivocal way to communicate to consumer code that the producer is known to generate a non-terminating stream. --

[issue33939] Raise OverflowError in __length_hint__ for consistently infinite iterators

2018-06-23 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: See also a meta-issue issue29833. If use OverflowError as a sign of infinite iterator in __length_hint__, this should be documented as a legitimate use case for OverflowError. itertools.repeat.__length_hint__() and reversed.__length_hint__() currently

[issue33939] Raise OverflowError in __length_hint__ for consistently infinite iterators

2018-06-22 Thread bbayles
Change by bbayles : -- nosy: +bbayles ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue33939] Raise OverflowError in __length_hint__ for consistently infinite iterators

2018-06-22 Thread Nick Coghlan
Nick Coghlan added the comment: Using OverflowError wouldn't mean "I'm infinite", it would only mean "I'm larger than sys.maxsize" (the same way it does for range objects). However, it may be that that's fine, since the information we really want to convey is: 1. Trying to store this