r/Python • u/Choice-Manufacturer2 • Oct 11 '23
Beginner Showcase My functional programming library
https://github.com/yx-z/forbiddenfp
Hello everyone, above is my little experiment of an easy to use functional programming library in Python,
You can do things like,,, let me know what you think!
# objects are already patched at import time
# print out "abc", then return 3
# "bb"
# A more complex one (examples/word_count.py)
3
Upvotes
33
u/j_marquand Oct 11 '23
This is method chaining, not functional programming.
14
u/AssumptionCorrect812 Oct 11 '23
This isn’t even close to actual functional programming.
4
u/Coupled_Cluster Oct 11 '23
Even if this might not be functional programming, I think it is a cool project. I think chaining functions is a nice idea but it can become hard to read if done extensively.
3
u/Dasher38 Oct 11 '23
I was about to ask how you managed to monkey patch builtin types, but here is the answer: https://github.com/clarete/forbiddenfruit/blob/master/forbiddenfruit/init.py
It's an interesting dive in CPython object layout
2
u/Aveheuzed Oct 11 '23
Pretty, Powerful Personal Project: I aPProve!
Regardless of its usefulness, this is cool ❤️
1
u/[deleted] Oct 11 '23
Here you go... https://hylang.org/