vlasovskikh/funcparserlib

Tutorial not working

sofianito opened this issue · 3 comments

Hi!

I'm getting an error at line 47: return reduce(lambda s, (f, x): f(s, x), list, z)

It complains about the ( before f

Anyone using this project?

I asked someone smarter than me and he said to change that line to:

return reduce(lambda x, y: y[0](x, y[1]), list, z)

The line as written here works in Python 2.x. But parameter tuple unpacking was removed in Python 3. The version here is the equivalent way to write it in Python 3 and also works in Python 2.

The lambda could be written like this to make the comparison clearer
lambda s, f_x: f_x[0](s, f_x[1])