FunkyBob, Today in my #python code I used:
result = [
term
for item in sequence
if (term := item.do_something()) != None
]I found it less ugly than the alternative:
result = list(filter(None, [item.do_something() for item in sequence]))
Though I'm not entirely convinced it's easier to reason about.
Add comment