In the following snippet I try to return a function which is returning a generator (weren't they once called iterators BTW?) with the step argument curried.
import math
import numpy
def aequi_ang_step(step):
def local_it(start, d_alpha, step):
for alpha in numpy.arange(start, start+d_alpha,(d_alpha < 0) and -step or step):
if (alpha < 2*math.pi): yield alpha
else: yield alpha-2*math.pi
return lambda start, d_alpha: local_it(start, d_alpha, step)
The thing works but as I am returning from a long abstinence back to Python my question is if this is an ok and pythonic way to curry iterators in Python.