4 ms·
I had similar feelings regarding anonymous functions before, having come from a more FP background. Ways to make your Python experience nicer: - almost never
by rtpg 7y ago
I had similar feelings regarding anonymous functions before, having come from a more FP background.
Ways to make your Python experience nicer:
- almost never try to use map or filter. List/set/dictionary comprehensions are more pythonic and will be easier in the long run
- learn about standard library stuff, especially the methods on dictionaries, as well as the collections package. If you’re thinking about lodash, Python tends to have replacements that end up being better tbh
- if you really want a local function, just creating an inner def statement is fine. But KISS should usually make this rare.