I just came across the problem that I could not use the built-in range() function of python for float values. So I decided to use a float-range function that I manually defined:
def float_range(start, stop, step):
r = start
while r < stop:
yield r
r += step
Problem is: This function returns a generator object. Now I needed this range for a plot:
ax.hist(some_vals, bins=(float_range(some_start, some_stop, some_step)), normed=False)
This will not work due to the return type of float_range(), which is a generator, and this is not accepted by the hist() function. Is there any workaround for me except not using yield?
yielda "workaround"? What did you hope to gain by usingyield?binsexpect? An integer? or a range?