On Feb 23, 2018 9:26 PM, "Steven D'Aprano" <steve at pearwood.info> wrote: Given a potentially expensive DRY violation like: [(function(x), function(x)+1) for x in sequence] there are at least five ways to solve it. A 6th way is to wrap the expensive function in @lru_cache() to make it non-expensive. [(a, a+1) for x in sequence for a in [function(x)]] It's funny to me how many people, even the BDFL, have said this is tricky to reason about or recognize. I didn't think of it all by myself, but saw it somewhere years ago. It seemed obvious once I saw it. Since then it's something I do occasionally in my code without much need for thought. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20180223/b7f47519/attachment.html>
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4