On 01Mar2021 00:06, MRAB <pyt...@mrabarnett.plus.com> wrote:
>I'm not seeing a huge problem here:
>
>Python 3.9.2 (tags/v3.9.2:1a79785, Feb 19 2021, 13:44:55) [MSC v.1928 
>64 bit (AMD64)] on win32
>Type "help", "copyright", "credits" or "license" for more information.
>>>> import time
>>>> class A:
>...     def __len__(self):
>...         return 1024**3
>...     def __iter__(self):
>...         yield from ()
>...
>>>> a = A()
>>>> len(a)
>1073741824
>>>> s = time.time()
>>>> list(a)
>[]
>>>> print(time.time() - s)
>0.16294455528259277

3.9.1 on MacOS: 14.529589891433716
3.9.2 on MacOS: instant again

Interesting. - Cameron Simpson <c...@cskk.id.au>
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to