Raymond Hettinger <raymond.hettin...@gmail.com> added the comment:
+0 I don't see any downside. Note, the benchmark only times instantiation of the filter object. It doesn't actually run the iterator which is where most of the runtime cost is spent. So in actual code there is almost zero benefit. For example, add "list" to the statement: stmt="b = list(filter(lambda x: x % 2 == 0, a))" and the improvement disappears. ---------- nosy: +rhettinger _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue43287> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com