What is the preferred way to tell someone \"I want to apply func to each element in iterable for its side-effects.\"
# Option 1...
This has been asked many times, e.g., here and here. But it's an interesting question, though. List comprehensions are meant to be used for something else.
Other options include
map() - basically the same as your samplefilter() - if your function returns None, you will get an empty listfor-loopwhile the plain loop is the preferable way to do it. It is semantically correct in this case, all other ways, including list comprehension, abuse concepts for their side-effect.
In Python 3.x, map() and filter() are generators and thus do nothing until you iterate over them. So we'd need, e.g., a list(map(...)), which makes it even worse.