Martin Panter added the comment: The trouble with Serhiy’s suggestion is that it would still try to iterate the argument:
>>> i = iter(lambda: print("ITERATION"), "infinity") >>> i in dict() # No iteration False >>> i in ItemsView(dict()) ITERATION ITERATION ITERATION False ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue24434> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com