+ 3

Why was python referred as partially object oriented programming?

python doesn't support strong encapsulation which is only one of many features associated with the term "object oriented "

16th Jul 2017, 12:03 PM
rithika
rithika - avatar
2 odpowiedzi
+ 1
hi
4th May 2018, 11:24 AM
Hemant K Hemant K
Hemant K Hemant K - avatar
+ 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.
16th Jul 2017, 12:06 PM
Art456
Art456 - avatar