Terji <terj...@yahoo.com> added the comment:

>> Why should ``all()`` special case ``range``? Apart from showing off 
>> benchmarks, what's the point?

Mostly to avoid silly mistakes, and the overhead of doing it would be very 
small, so a very small trade-off.

>> Should ``any()`` also special case it?

No, ``any()``takes at most two iterations to check truthiness in a ``range()``, 
so that's wouldn't be needed.

>> How about other lazy sequences and computed iterables, such as 
>> itertools.count objects, itertools.cycle objects, itertools.repeat objects, 
>> etc? How many special cases do we want?


No, I wouldn't propose that. The argument would be that those are 
iterators/generators while ``range()`` is special-cased built-in sequence with 
known properties.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue37131>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to