Is Python Object-Oriented or Procedural Language

twitter logo ・1 min read

Python is widely used in the programming language of today. It has gained great success in the field of scripting, data analytics, machine learning and much more.

But, as a programmer and developer, it becomes mandatory to verify if Python supports the concepts of Object-Oriented Programming Language (OOPS)

Read a detailed tutorial at Is Python Object Oriented

twitter logo DISCUSS (1)
markdown guide

Python is officially multi-paradigmatic. It fully supports all the design patterns and principles of Object-Oriented Programming Functional Programming, and Procedural Programming. You can write purely in any one of the paradigms, albeit with some discretion if you're targeting Functional, or you can combine them.

In terms of Object-Oriented Programming, SOLID is entirely supported. Inheritance and abstract classes work as they should. Any and all of the OOP design patterns can be implemented in Python, although none are strictly required.

Perhaps the only OOP oddity about the language is the lack of data hiding. However, this is only an artificial issue: Python uses the social convention of preceding "non-public" attributes with _ to indicate they aren't supposed to be modified. Name mangling can also be invoked by preceding a name with __, although this is intended to prevent name collisions in inheritance, not to actually hide data.

Additionally, support for any built-in function or language feature can be added to any class just by implementing the necessary special (or "dunder") methods. For example, implementing the __next__() method makes that class an iterable.

So, yes, Python is fully Object-Oriented, but OOP is not mandatory when using the language.

Classic DEV Post from May 26

How to Stay Fit Physically and Mentally and Keep Coding

Throughout the last year, I have worked part-time as a working student and also studied at the university. I was not the first and not the last one who has combined that during their studies, but the problem for me was, that at the end of the day I have felt absolutely exhausted mentally and physically. That caused problems with my health and motivation to continue working on my goals or anything. (yeah, “goals,” I wish I had something more specific at that time).

TechCluesBlog profile image
TechCluesBlog is an E-learning platform for web developers to learn Laravel Tutorials, OpenCart, WordPress, MySQL, Linux