0
$\begingroup$

My understanding is that a programming language is generally paradigm (functional, procedural, OOP) independent: we can code using different paradigms in some language. However, some languages, like Java, seem to require the developer to code only in OOP. And the language C does not even support OOP.

In regards to Python, everything (variable, function, module, list, etc.) seems to be an object, i.e. an instance from a class. But we can certainly code in Python without creating classes, etc...So is Python intrinsically OOP even if we don't necessarily have to code with the OOP approach? Could we say that is OOP but less OOP than Java?

Thanks for any clarification.

$\endgroup$
1
  • 3
    $\begingroup$ What do you mean by "OOP"? What do you mean by "truly"? Without a definition of those two terms, it is going to be pretty hard to answer the question. For example, according to my definition of OOP, Python is much more OOP than Java is, but that does not say anything about whether or not that is true according to your definition. $\endgroup$ Jan 23, 2022 at 21:12

2 Answers 2

3
$\begingroup$

Indeed: Python supports OOP, but unlike Java, doesn't enforce it. So that seems the most accurate statement regarding the matter.

Based on this, it makes sense to say that Python is OOP but less so than Java, or Python is not OOP but supports it; but why would you?

  • These statements are vague. They invite confusion. Why not just say what you mean instead of hinting at it?
  • These statements suggest that there is some benefit or value in trying to grade languages by OOP-ness. This invites debate, but what's the point? Can you think of a benefit of trying to grade languages by OOP-ness, from a computer science perspective? I do understand its use as a device for attracting eyeballs to an article, but clickbait theory is off-topic here.
$\endgroup$
4
  • $\begingroup$ great @reinierpost. I see that semantics are not that important. Just making sure I don't have conflicting understanding. Stating that "computer languages are paradigm independent" may not be correct for all cases since Java and Python do favor OOP and their underlying structure is object based....Just a beginner here making sense of things. Smalltalk (I never used it) is a very OOP language...Thanks $\endgroup$ Jan 22, 2022 at 20:03
  • $\begingroup$ "Python supports OOP, but unlike Java, doesn't enforce it." – How does Java "enforce OOP"? In fact, the overwhelming majority of Java code in the wild, is Abstract Data Type-oriented, not Object-oriented. $\endgroup$ Jan 23, 2022 at 21:10
  • 1
    $\begingroup$ Python does enforce OOP inasmuch as all values are objects and all operations on them are method calls. If your program is print(1+2) then print, 1, and 2 are objects, + is sugar for a call of 1's __add__ method, and the parentheses are sugar for a call of print's __call__ method. I don't see why having to define a dummy class before you can do anything with the built-in objects should be a requirement for an OOP language. Smalltalk doesn't require that. $\endgroup$
    – benrg
    Jan 24, 2022 at 0:53
  • $\begingroup$ Good point, thanks ... I may need to rewrite. $\endgroup$ Jan 24, 2022 at 13:21
-1
$\begingroup$

There are 2 interpretations of the term OOP.

Consider the scenario where you are developing you own programming language. There are several phases of compiling a program and internal modules to provide support and you have implemented them in an OOP fashion, but the programming language you intend to develop doesn't enforce OOP paradigm while writing programs, so in this case the core features are done in an OOP fashion but the language isn't. Similarly there can be other cases too (it gets complicated diving into cross compiling and bootstrapping). An example of this is python, which has its interpreter implemented in many languages like C (procedural) and java(object oriented) but python itself supports both paradigms and doesnt enforce to use any one.

So in short, OOP can mean 2 things, either the language was implemented in an OOP fashion or the language asks you to program in an OOP fashion, and mostly the latter suits the OOP ideology better.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.