Yeah i did a multi level nested one once including else clauses, and it didnt actually assign to anything, only side effects. Felt clever at the time.
But it was completely incomprehensible and unmaintainable. So got replaced by me later.
But it was completely incomprehensible and unmaintainable. So got replaced by me later.
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.sent = [(u, send_welcome_email(u)) for u in users]
not_sent = users - {u for u in users if send_welcome_email(u)}
Just make sure it isn't consuming a lot of RAM and it's totally OK.