3 ms·
Thanks for posting this. Many years ago (2006?) I was a just-out-of-university programmer and a friend of a friend who wrote Python for Canonical sat me down an
by vintagedave 3y ago
Thanks for posting this. Many years ago (2006?) I was a just-out-of-university programmer and a friend of a friend who wrote Python for Canonical sat me down and tried to teach me functional programming using Python. I was a poor learner: I didn't 'get it' (functional programming in general) and, to my regret, learned nothing.
Much time has passed and I hope I'm a more aware and open-to-new-things person today :) I use Python these days though in a traditional procedural / OO way. This post reminded me that maybe I should look into writing it functional-style. Thankyou!
- FrustratedMonky 3y agoI find that learning functional style in a language that does not enforce it, is extra difficult. If the language does not provide guard rails, then new learners will fall back on non-functional methods, and not even realize it.
- OkayPhysicist 3y agoI very much support this view. If you want to teach someone functional programming, you go straight to Haskell or a Lisp. They don't need to master the language or anything, but the cold shower of "There are fundamentally different paradigms in programming than those I am used to" combined with a language that will allow nothing but functional code tends to work a lot better than "Hey guys! Let's torture Java to support map/filter/reduce!"
- qbasic_forever 3y agoIMHO broaden your boundaries a bit and learn a lisp or clojure-based functional style, like grab a getting started in clojure book and work through it. You will learn a lot more than this guide goes into, it's really just looking at functions in a functional style but doesn't spend nearly enough on data structures and state which are really the core of functional programming (and what python doesn't do well out of the box for functional programming). Learning a bit of clojure will really open your eyes to what functional programming means, and you can take some of those learnings back to python.
- eyelidlessness 3y agoI’ll second this. Learning Clojure radically changed how I think about programming, regardless of what language I program in now. Both because of the restrictions of FP itself, but also (and, IMO, at least as importantly) because pervasive FP solutions at the language/stdlib level are an excellent source of inspiration and guidance for “thinking in” FP. The great thing is that FP as an approach does translate very well to most imperative/OO contexts. It just isn’t necessarily very obvious how it will, until/unless you’ve been fully immersed and embraced it.