yield iteration

Tobias Pankrath tobias at pankrath.net
Sun Jul 29 06:58:03 PDT 2012


>
> This is an example of Inverse Gray iterator (Sloane series 
> A006068) Python2 code from:
> http://code.activestate.com/recipes/221457/
>
> def A006068():
>     yield 0
>     for x in A006068():
>         if x & 1:
>             yield 2 * x + 1
>             yield 2 * x
>         else:
>             if x:
>                 yield 2 * x
>             yield 2 * x + 1
>

Does this spawn linear many generators?


More information about the Digitalmars-d mailing list