Author serhiy.storchaka
Recipients Jacob RR, ammar2, docs@python, serhiy.storchaka, steven.daprano
Date 2020-04-09.08:08:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1586419710.71.0.38139626192.issue40202@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2020-04-09 08:08:30serhiy.storchakasetrecipients: + serhiy.storchaka, steven.daprano, docs@python, ammar2, Jacob RR
2020-04-09 08:08:30serhiy.storchakasetmessageid: <1586419710.71.0.38139626192.issue40202@roundup.psfhosted.org>
2020-04-09 08:08:30serhiy.storchakalinkissue40202 messages
2020-04-09 08:08:30serhiy.storchakacreate