Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment:
It was discussed in issue39816. I do not think that calling len() and ignoring any exception is a good idea. 1. This may silence some exceptions (errors in the __len__ implementation, MemoryError, RecursionError, KeyboardInterrupt) which should not be silenced. 2. __len__() may have side effect. 3. __next__() may affects the result of __len__() (for example __next__() pops a value of the queue, and __len__() returns the size of the queue), so using the result of __len__() after calling __next__() may be misleading. Since the original report was about 2.7 which is no longer maintained, I propose to close this issue as outdated. ---------- nosy: +serhiy.storchaka _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue40202> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com