[issue1283110] Give __len__() advice for "don't know"

Benjamin Peterson report at bugs.python.org
Tue Feb 17 21:13:30 CET 2009


Benjamin Peterson <benjamin at python.org> added the comment:

On Tue, Feb 17, 2009 at 1:27 PM, Antoine Pitrou <report at bugs.python.org> wrote:
>
> Antoine Pitrou <pitrou at free.fr> added the comment:
>
> If iterators don't want their boolean value to be messed up, couldn't
> they simply use __bool__ for that?

Since there is no base iterator class, that would complicate the API
and lead to subtle bugs. Personally, I don't think any iterators
should supported len() at all.

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1283110>
_______________________________________


More information about the Python-bugs-list mailing list