concept of "objects", which are data structures that contain data, in the form of fields, o en known as a ributes; and code, in the form of procedures, o en known as methods.” Wikipedia Definition
It's called first, and is responsible for returning a new instance of your class. In contrast, __init__ doesn't return anything; it's only responsible for initializing the instance a er it's been created.
is based on another object (prototypal inheritance) or class (class-based inheritance), using the same implementation (inheriting from an object or class) specifying implementation to maintain the same behavior (realizing an interface; inheriting behavior). It is a mechanism for code reuse and to allow independent extensions of the original so ware via public classes and interfaces. The relationships of objects or classes through inheritance give rise to a hierarchy. Inheritance was invented in 1967 for Simula.” Wikipedia Inheritance
of two related but distinct notions, and sometimes to the combination thereof: A language mechanism for restricting access to some of the object's components. A language construct that facilitates the bundling of data with the methods (or other functions) operating on that data” Wikipedia Encapsulation
def get_weapon(self): print 'My sword is ready!!!' player = PLayerCharacter() player.__get_weapon() Traceback (most recent call last): File "incapsulating.py", line 14, in <module> player.__get_weapon() AttributeError: 'PLayerCharacter' object has no attribute '__get_weapon' # But you can call it like this: player._PLayerCharacter__get_weapon() ==> 'I am hidden secret weapon'
of a single interface to entities of different types. A polymorphic type is one whose operations can also be applied to values of some other type, or types” Wikipedia Polymorphism