6 ms·
I worked with a guy that did this. Instead of writing for loops he would write comprehensions everywhere because "list comprehensions are pythonic". Think lik
by leetrout 4y ago
I worked with a guy that did this.
Instead of writing for loops he would write comprehensions everywhere because "list comprehensions are pythonic".
Think like:
[send_welcome_email(u) for u in users]
Just hanging out in the middle of the module or function.
- 83457 4y agoI prefer sent = [(u, send_welcome_email(u)) for u in users]
- Waterluvian 4y agoJust make the function return the argument passed into it. ;)
- Ultimatt 4y agoI prefer not_sent = users - {u for u in users if send_welcome_email(u)}
- 83457 4y agowoah