When to use classes (OOP)?
📁 oop, method, Encapsulation: Private Attributes and Properties, Advanced Python Topics, Useful Tips and Lifehacks, AI, lesson
I've been studying/programming in Python for about a year now, but I still can't understand when to use classes. Reading books and watching video tutorials, I understand things like encapsulation or what abstraction is. But when it comes to the moments when exactly I need to use OOP, I get stuck.
In my thinking, classes can be replaced by modules with a set of thematic functions. No self's before variables and as the first argument of methods, no class declarations before use, just import and use.
What advice/study material can you give for understanding this topic and learning OOP in general?
P.S. I saw the question, but it didn't answer mine.
Python is an interpreted programming language. The source code is executed directly, command by command (sometimes with minimal preparation, literally after parsing the source code into an AST) — the program simply cannot be run without an interpreter.
In the case of the most common implementation (CPython: written in C, often simply called "Python"), the answer is: interpreted, with some compilation. CPython compiles Python source code into bytecode, and then interprets this bytecode, running it in the process.
Partially taken and supplemented
Also
Python is an interpreted, object-oriented, high-level programming language...
Log in to leave an answer
Blogs
Regular Expressions in Kotlin: Complete Guide with Examples