This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author samuelmarks
Recipients eric.smith, josh.r, kj, rhettinger, samuelmarks, steven.daprano
Date 2020-12-21.09:19:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1608542396.64.0.995713479884.issue42699@roundup.psfhosted.org>
In-reply-to
Content
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?

:(
History
Date User Action Args
2020-12-21 09:19:56samuelmarkssetrecipients: + samuelmarks, rhettinger, eric.smith, steven.daprano, josh.r, kj
2020-12-21 09:19:56samuelmarkssetmessageid: <1608542396.64.0.995713479884.issue42699@roundup.psfhosted.org>
2020-12-21 09:19:56samuelmarkslinkissue42699 messages
2020-12-21 09:19:56samuelmarkscreate