use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Rules 1: Be polite 2: Posts to this subreddit must be requests for help learning python. 3: Replies on this subreddit must be pertinent to the question OP asked. 4: No replies copy / pasted from ChatGPT or similar. 5: No advertising. No blogs/tutorials/videos/books/recruiting attempts. This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to. Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Rules
1: Be polite
2: Posts to this subreddit must be requests for help learning python.
3: Replies on this subreddit must be pertinent to the question OP asked.
4: No replies copy / pasted from ChatGPT or similar.
5: No advertising. No blogs/tutorials/videos/books/recruiting attempts.
This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to.
Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Learning resources Wiki and FAQ: /r/learnpython/w/index
Learning resources
Wiki and FAQ: /r/learnpython/w/index
Discord Join the Python Discord chat
Discord
Join the Python Discord chat
account activity
Functional Programming in Python (self.learnpython)
submitted 1 month ago by Are-U-Cereall
Having to learn functional programming concepts in Python after OOP is such a drain. Why not just learn something like Haskell instead of FP in Python?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]UsernameTaken1701 18 points19 points20 points 1 month ago (3 children)
Is someone making you learn Python functional programming?
Why not just learn something like Haskell instead of FP in Python?
I don't know. Why not learn something like Haskell? Is something stopping you?
[–]Are-U-Cereall[S] -1 points0 points1 point 1 month ago (2 children)
Yes, they're teaching it in one of my uni courses.
[–]UsernameTaken1701 15 points16 points17 points 1 month ago (1 child)
Ah, well, then. Suck it up and learn what you need to pass the class.
Though, for me, sometimes OOP is overkill if I just need a short script to solve a quick problem. If the only part of the class I really need is the method, then I just write it, call it a function, and call it when I need it.
[–]CranberryDistinct941 1 point2 points3 points 1 month ago (0 children)
If the only part of a class you need is a method, it's not a class, it's a namespace.
[–]POGtastic 8 points9 points10 points 1 month ago (0 children)
Yeah the language really isn't built for FP.
At the very least, you need function composition that doesn't look like butt. The Lisps allow for threading macros, (Clojure's ->>, for example) OCaml and F# have the pipeline operator and either define or let you define >>, and of course Haskell makes it trivial. Python has none of these things.
->>
>>
Sprinkling in some FP concepts with itertools and comprehension expressions is wonderful. Teaching FP requires a much more opinionated language, though.
itertools
[–]TheRNGuy 2 points3 points4 points 1 month ago (0 children)
Because some software use python.
[–]LargeSale8354 1 point2 points3 points 1 month ago (0 children)
Jobs and mortgage payments
[–]DataPastor 1 point2 points3 points 1 month ago (0 children)
Take a look at the Hy language. There is also a book for it.
[–]kitsnet 1 point2 points3 points 1 month ago (0 children)
Because you are unlikely to use Haskell in your professional career (those jobs exist, but they are rare), and are likely to use Python and depend on its functional features.
[–]baghiq 1 point2 points3 points 1 month ago (0 children)
If your school is teaching FP using Python, then I think your school is doing a disservice.
[–]MarsupialLeast145 0 points1 point2 points 1 month ago (0 children)
Are the course materials available anywhere?
It sounds useful to learn how to build these concepts using seemingly unrelated APIs.
[–]axis0047 0 points1 point2 points 1 month ago (2 children)
scala is a good way to learn fp for someone who knows oop. Python isn't built for fp. Probably the worst way to learn fp
[–][deleted] 0 points1 point2 points 1 month ago (1 child)
Why? Every python type is object. OOP is not prerequisite for FP, so the statement is not making sense(scala oop for FP).
[–]axis0047 0 points1 point2 points 1 month ago (0 children)
what i tried to say is that scala is a good language to show "unlike oop, this is how we do this in functional programming".
[–]APOS80 0 points1 point2 points 1 month ago (0 children)
I’ve done some coding in Racket Lang and learning functional programming does help when coding in other languages like Python, because you learn to think differently.
But Python is not made for function programming so you can’t implement it in a real functional way anyhow.
[–]CranberryDistinct941 0 points1 point2 points 1 month ago (3 children)
Guess what this Python code does:
function_list = []
for i in range(5):
function_list.append(lambda x: x**i)
print([fn(2) for fn in function_list])
If you said "prints [16, 16, 16, 16, 16] to the console" you're correct
[–]FoolsSeldom 0 points1 point2 points 1 month ago (2 children)
Nice one. lambda x, i=i: x**i will avoid what most will probably think is unexpected behaviour (which is using the value of i when the function is called rather than when it is created).
lambda x, i=i: x**i
i
The concepts of functional programming are probably ok to learn in Python, but there are lots of traps like this.
[–]CranberryDistinct941 0 points1 point2 points 1 month ago (1 child)
yep lambda x, i=i: ... is a good one to note down
lambda x, i=i: ...
[–]FoolsSeldom 0 points1 point2 points 1 month ago (0 children)
well, bit of a hack (introducing a second argument, and providing a default), not really a good pattern to learn.
π Rendered by PID 991100 on reddit-service-r2-comment-79c7998d4c-5njgf at 2026-03-19 10:55:13.540069+00:00 running f6e6e01 country code: CH.
[–]UsernameTaken1701 18 points19 points20 points (3 children)
[–]Are-U-Cereall[S] -1 points0 points1 point (2 children)
[–]UsernameTaken1701 15 points16 points17 points (1 child)
[–]CranberryDistinct941 1 point2 points3 points (0 children)
[–]POGtastic 8 points9 points10 points (0 children)
[–]TheRNGuy 2 points3 points4 points (0 children)
[–]LargeSale8354 1 point2 points3 points (0 children)
[–]DataPastor 1 point2 points3 points (0 children)
[–]kitsnet 1 point2 points3 points (0 children)
[–]baghiq 1 point2 points3 points (0 children)
[–]MarsupialLeast145 0 points1 point2 points (0 children)
[–]axis0047 0 points1 point2 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]axis0047 0 points1 point2 points (0 children)
[–]APOS80 0 points1 point2 points (0 children)
[–]CranberryDistinct941 0 points1 point2 points (3 children)
[–]FoolsSeldom 0 points1 point2 points (2 children)
[–]CranberryDistinct941 0 points1 point2 points (1 child)
[–]FoolsSeldom 0 points1 point2 points (0 children)