Moving to Functional - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: General (https://python-forum.io/forum-1.html) +--- Forum: Code Review (https://python-forum.io/forum-46.html) +--- Thread: Moving to Functional (/thread-31472.html) Pages:
1
2
|
RE: Moving to Functional - Gribouillis - Dec-16-2020 @ndc85430 I know that numpy is not necessary to this task. Only 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.
RE: Moving to Functional - swisscheese - Dec-17-2020 Gribouillis - Tested and works - nice work! Now I just have to work on getting my head around it ;-) |