[issue37131] all(range()...)) is needlessley slow

2019-06-02 Thread Terji
Terji added the comment: >> If there were special dunders __all__ and __any__ it would be easy to >> encapsulate this behaviour inside the range objects themselves, and neither >> any() nor all() would need to know anything about range objects. This sounds very interesting

[issue37131] all(range()...)) is needlessley slow

2019-06-02 Thread Terji
Terji 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 spec

[issue37131] all(range()...)) is needlessley slow

2019-06-02 Thread Terji
New submission from Terji : Checking if a range's items are ll truthy can be done y checking if 0 the range contains 0, however currently Python iterates over the range, making the operation slower than needed. >>> rng = range(1, 1_000_000) >>> timeit all(rng)

[issue31564] NewType can subclass NewType

2017-09-23 Thread Terji
New submission from Terji: It has become possible to create a ``NewType`` from an existing ``NewType``, see https://github.com/python/mypy/pull/3465 and https://github.com/python/peps/pull/271. This is a small update to the documentation as a concequence of the above change