Dec-16-2020, 07:52 AM
(This post was last modified: Dec-16-2020, 07:55 AM by Gribouillis.)
@ndc85430 I know that numpy is not necessary to this task. Only
Thanks for the link to Toolz. I often use the more_itertools library already that helps managing iterables. I understand the advantages of less state and mutability and I like the idea of functional languages, but I have never used them for serious programs because they become very difficult to read as the program grows.
A nice thing in Python is the
numpy.sum()
should be faster on numpy arrays than the above ersatz of sum of lists.Thanks for the link to Toolz. I often use the more_itertools library already that helps managing iterables. I understand the advantages of less state and mutability and I like the idea of functional languages, but I have never used them for serious programs because they become very difficult to read as the program grows.
A nice thing in Python is the
yield
keyword. The above program could be written in a more human way by using 'yield' instead of 'itertools.chain'. It could help build a proper balance between imperative and functional programming in Python.