This has to be a stupid question, but :)<div><br></div><div>I have some generators that do stuff, then start yielding results. On occasion, I don't want them to yield anything ever-- they're only really "generators" because I want to call them /as/ a generator as part of a generalized system.</div>

<div><br></div><div>The only way I can figure out how to make an empty generator is:</div><div><br></div><div>    def gen():</div><div>        # do my one-time processing here</div><div><br></div><div>        return</div>

<div>        yield</div><div><br></div><div>Is there a better way? The return/yield just makes me flinch slightly. I tried just raising StopIteration at the end, but of course that didn't work.</div><div><br></div><div>

TIA,</div><div><div name="mailplane_signature">--S</div></div>