nsmith5 / PyGen

Python generators in Julia, yield statements for all!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

IMPORANT: See the ResumableFunctions package for a performant and more complete implementation of this concept

PyGen travis-img codecov-img

Python generators are great, Julia is great. Why compromise?

julia> using PyGen

julia> @pygen function fibonacci()
           n, m = 0, 1
           while true
               yield(m)
               n, m = m, n + m
           end 
       end
fibonacci (generic function with 1 method)

julia> for i in fibonacci()
           println(i)
           sleep(1)
       end
1
1
2
3
5
8
13
.
.
.

Voila! Generators without all the ceremony!

About

Python generators in Julia, yield statements for all!

License:Other


Languages

Language:Julia 100.0%