Is it Pythonic to use set comprehensions for just side effects?

48 Views Asked by At

Question related to this which asks about side effects in list comprehensions.

def side_effects_only(x):
    # ...side effects...
    return # None

used as

{side_effects_only(x) for x in Y}
# where Y is large...

This shouldn't generate some giant set if Y is large. Since it is a set with a single None. Or ...?

Thanks!

0

There are 0 best solutions below