Message366037
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. |
|
Date |
User |
Action |
Args |
2020-04-09 08:08:30 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, steven.daprano, docs@python, ammar2, Jacob RR |
2020-04-09 08:08:30 | serhiy.storchaka | set | messageid: <1586419710.71.0.38139626192.issue40202@roundup.psfhosted.org> |
2020-04-09 08:08:30 | serhiy.storchaka | link | issue40202 messages |
2020-04-09 08:08:30 | serhiy.storchaka | create | |
|