A Comprehensive Introduction to Python Programming and ... - MSDL
A Comprehensive Introduction to Python Programming and ... - MSDL
A Comprehensive Introduction to Python Programming and ... - MSDL
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
1.2 Language Features 15 / 75<br />
The inheritance list argument is optional. It must be included in brackets<br />
if present. It can contain one or more class names, separated by commas. It will most<br />
often contain only one class name: the base class of the current class, ie the class that<br />
it inherits from.<br />
<strong>Python</strong> supports multiple inheritance in the form of mixin classes. These classes<br />
inherit from multiple base classes (ie the inheritance list contains more than<br />
one class. <strong>Python</strong> uses a depth-first search, left-<strong>to</strong>-right strategy <strong>to</strong> find attributes in<br />
multiple inheritance cases. Whenever a list of base classes is specified, the leftmost<br />
class will be searched first for a specific attribute, followed by all of its base classes.<br />
If nothing is found in these classes, then the second base class will be searched in the<br />
same way, <strong>and</strong> so on.<br />
<strong>Python</strong> has no access specifier (like private, public or protected in Java). By default,<br />
all methods declared within a class are public. Simulating private methods is still<br />
possible by using the same name mangling feature as it was done for variables (see<br />
section 1.2.2.1 on page 5). This is done by preceding the method name by two or more<br />
underscores.<br />
Inside a class, the self keyword refers <strong>to</strong> the current instance of this class.<br />
1.2.7.1 Special function names<br />
<strong>Python</strong> defines some special function names that have a predefined meaning. These reserved<br />
names all have the form special name , so as <strong>to</strong> minimize the possibility<br />
of name conflicts. The following table lists the most common ones <strong>and</strong> describes their<br />
meaning.