self In Python Class

Python Class provides the self in order to use the internal variables and methods of the class. The self is very useful because it provides direct access without any extra definition. If the self keyword is not used a global variable or function is called instead of the class internal variable or method. The self … Read more

Python Constructor Tutorial

Python Constructor Tutorial

Python constructors are used to creating new instances or objects. User-defined classes or Python-provided objects can be created using a constructer. The constructer is defined with the def __init__() function definition inside the class definition. Default Constructor The default constructor is used to create an object without providing any parameter dynamically. The object is constructed … Read more

Python getattr() Function Tutorial

Python getattr() Function Tutorial

Python provides the getattr() function which is used to get and return specified object attributes. Every attribute has a different name and this name is used to return the attribute value. If the specified attribute does not exist an error or default value provided to the getattr() function is returned. getattr() Function Syntax The syntax … Read more