Samuel Marks <samuelma...@gmail.com> added the comment: Yeah I hear ya, was just trying for the most concise issue title. I tend to [over]use `map`, `filter`, `filterfalse` and other `itertools` and `operator` methods in my own codebase.
Surprised with that result, that using an explicit list is actually faster. Seems like an obvious* micro-optimisation. *But don't want to say that unless I'm actually maintaining/contributing-to your C code. It's also surprising—last time I checked—that lists are faster to construct than tuples. When I create codebases or maintain other peoples, I try and: - remove all unnecessary mutability (incl. replacing lists with tuples); - flatten `.append` occurrences into generator comprehensions or map; - remove all indentation creating for-loops, replacing with comprehensions or map and functions or lambdas - combine generators rather than concatenate lists; The general idea here is to evaluate at the time of computation, and be lazy everywhere else. So searching the whole codebase for lists and other mutable structures is a good first step. But maybe with efficiency losses, like shown here, means that this would only aid [maybe] in readability, understandability, traceability & whatever other functional -ility; but not performance? :( ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue42699> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com