[issue40202] Misleading grammatically of ValueError Message?
Serhiy Storchaka
report at bugs.python.org
Thu Apr 9 04:08:30 EDT 2020
Serhiy Storchaka <storchaka+cpython at 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 <report at bugs.python.org>
<https://bugs.python.org/issue40202>
_______________________________________
More information about the Python-bugs-list
mailing list