New submission from yoch:
collections.abc.Iterable don't implement the __bool__ method. This may
seriously degrade performance in case __len__ is not efficient.
I suggest to implement it as :
class Iterable:
...
def __bool__(self):
try:
next(iter(self))
return True
except StopIteration:
return False
----------
components: Library (Lib)
messages: 253690
nosy: yoch.melka
priority: normal
severity: normal
status: open
title: collections.abc.Iterable don't implement __bool__
type: enhancement
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue25513>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com