Serhiy Storchaka <[email protected]> added the comment:
Adding the __contains__() method to the count iterator would not solve the
general problem with infinite iterators. For example with the following
expressions:
-1 in filter(None, itertools.count())
-1 in map(float, itertools.count())
It is not worth to add a method just to handle a single case of misusing. You
should not use "in" with infinite iterators.
----------
nosy: +serhiy.storchaka
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue37040>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com