Another way is
def empty_generator():
return
yield
Not really “more expressive”, but shorter. 🙂
Note that iter([])
or simply []
will do as well.
Another way is
def empty_generator():
return
yield
Not really “more expressive”, but shorter. 🙂
Note that iter([])
or simply []
will do as well.