Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Python is kind of a strange beast - definitely imperative but with some FP-ish features: functions first-class citizenship, list comprehensions, generator functions/expressions (and there is the functools module). It is gaining more and more native immutable collections with each release. This multi-paradigm approach is what makes it one of the best glue-languages out there.

Python lacks tail call optimizations and recursion dept is limited to ~1000, so if your algorithm is not O(log n) or better you may have to convert from recursive to iterative (there is a recipe that makes conversion trivial) but other than that I'm content with its FP-style features.



I guess many beginner developers haven't realize this feature of Python yet. There are a couple of lib to enhance the FP feature of Python. Like itertool, functool, maybe more. In PySpark there are many functions take other function as parameters.

Another language is JavaScript. It uses function as parameter all the time but often just one time but not in a general way. Seems no JavaScript developer really seriously care about the term FP or OO.


>Seems no JavaScript developer really seriously care about the term FP or OO.

Oh no, they care. The reason it doesn't seem like FP is big in the web dev world is because of reactive programming paradigm.

Reactive programming paradigm is designed so when one part of the program is processing it doesn't lock up the UI elements. This defaulting to being thread safe and lock free comes from the FP world.

Reactive programming is a marriage between functional programing and procedural programming paradigms and is incredibly popular. I suspect it is far more popular in the front end world than FP is in the back end world, showing their adoption, despite different, is stronger.

--

On the backend side of things, many of the popular languages have been slowly gaining FP toys, not just Python. C++, Java, Scala, and so on..




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: