How to make an empty generator?

Robert Kern robert.kern at gmail.com
Fri Feb 19 07:16:30 CET 2010


On 2010-02-18 18:33 PM, Ben Finney wrote:
> Robert Kern<robert.kern at gmail.com>  writes:
>
>> He doesn't want *any* empty generator. He wants an iterator that
>> executes some given side-effect-producing code then immediately raises
>> the StopIteration.
>
> Ah, hm. That's a rather perverse use case, but I'm sure the OP has their
> reasons.

Which he explained fairly clearly, I thought, in his original post.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco




More information about the Python-list mailing list