Best way to generate alternate toggling values in a loop?

Luis Zarrabeitia kyrie at
Thu Oct 18 19:47:01 CEST 2007

On Thursday 18 October 2007 09:09, Grant Edwards wrote:
> I like the solution somebody sent me via PM:
> def toggle():
>     while 1:
>         yield "Even"
>         yield "Odd"

That was me.
Sorry, list, I meant to send it to everyone but I my webmail didn't respect 
the list* headers :(.

Thanks, Grant!

Luis Zarrabeitia (aka Kyrie)
Fac. de Matemática y Computación, UH.

More information about the Python-list mailing list