This is a good default
This output method is very similar to outputting the \$n\$-th value in a sequence.
If you implement a function f
which returns the \$n\$-th value in the sequence, then the sequence is map(f, integers)
. If f
is a membership oracle, the sequence is filter(f, integers)
. I think the difference between a map over the integers and a filter over them is small enough that if we allow one we should allow the other, unless the writer explicitly excludes it.
Another perspective to this similarity is the operations: outputting the \$n\$-th value in the sequence, compared to outputting the \$n\$-th value in the indicator sequence. A strictly increasing integer sequence and its indicator sequence are very closely tied, so I think both output methods should be allowed. In fact, this even suggests a broadening of the suggestion — answers can choose whether to output the sequence or the indicator sequence, using any of the default methods for either, although that's a discussion for another time.
for element in range: if valid: print(element)
). It could work with strings, perhaps, but I can't think of any other data types which has that naturally \$\endgroup\$