2 odpowiedzi
+ 1
hi
+ 9
Python is or can be used in an object oriented paradigm.
Object oriented requires that the language can define objects from classes that have their own attributes and one can inherit from other and when a method on that object is called, the call is a dynamic dispatch decided at runtime. There is also this thing about polymorphism and and operator overloading. Most of this happens in python and so it can be called an object oriented language.
Since you have specifically pointed out encapsulation.
Python doesn't support strong encapsulation, which is only one of many features associated with the term "object-oriented".
Encapsulation is defined as
language mechanism for restricting access to some of the object's componentslanguage construct that facilitates the bundling of data with the methods (or other functions) operating on that data
Now nothing in python is purely private. You can make it hard to access or obfuscate it further but it is still not the Java kind of private and the reason why it is like that is that Guido van Rossum believed it will be 'all adults using the language(sensibly)' .
Not all attributes of a python class can just be accessed for their value. By pre pending a single underscore (don't expose) or double underscore (hide), you're telling the user of your class that you intend the member to be 'private' in some way.