3 ms·
Python is multi-paradigm; it's not dominantly OO. Comparing python libraries to java libraries, functional composition is used just as frequently as OO composit
by jasonjackson 15y ago
Python is multi-paradigm; it's not dominantly OO. Comparing python libraries to java libraries, functional composition is used just as frequently as OO composition (if not more so).
If you're building a website, in Python/Django, you pass in your request handler function using first class functions. In java, you inherit from the request handler class, and override the method.
JsonTools loads and dumps are pure functions. In java, josn.org, there's a class for each JSON type that you interact with.
That being said, I can also think of many Python libraries that use classes.
- wahnfrieden 15y agoThe use of functions doesn't itself mean "functional programming" - is C a FP language, for instance?
- szany 15y agoYes! http://conal.net/blog/posts/the-c-language-is-purely-functional/ http://conal.net/blog/posts/the-c-language-is-purely-functio...
- jerf 15y agoFunctions are objects in Python. Thanks to __call__, quite profoundly so. Multiparadigm is a bit oversold; in any language, when paradigms conflict, something wins. Either you consistently choose something, in which case you get a coherent language, or you don't, in which case you get an incoherent mismash (which may be usable, but tends to scale poorly in the end). In Python, that something is OO. OO broadly means the base abstraction of the language syntax and base libraries is classes and objects. That's Python. Everything is an object, even when that's papered over with things that don't wave it in your face.