python-oop

Contents

Roadmap info from roadmap website

OOP

In Python, object-oriented Programming (OOPs) is a programming paradigm that uses objects and classes in programming. It aims to implement real-world entities like inheritance, polymorphisms, encapsulation, etc. in the programming. The main concept of OOPs is to bind the data and the functions that work on that together as a single unit so that no other part of the code can access this data.

Visit the following resources to learn more:

Classes

A class is a user-defined blueprint or prototype from which objects are created. Classes provide a means of bundling data and functionality together. Creating a new class creates a new type of object, allowing new instances of that type to be made. Each class instance can have attributes attached to it for maintaining its state. Class instances can also have methods (defined by their class) for modifying their state.

Visit the following resources to learn more:

Inheritance

Inheritance allows us to define a class that inherits all the methods and properties from another class.

Visit the following resources to learn more:

Methods and Dunder

A method in python is somewhat similar to a function, except it is associated with object/classes. Methods in python are very similar to functions except for two major differences.

  • The method is implicitly used for an object for which it is called.
  • The method is accessible to data that is contained within the class.

Dunder or magic methods in Python are the methods having two prefix and suffix underscores in the method name. Dunder here means β€œDouble Under (Underscores)”. These are commonly used for operator overloading. Few examples for magic methods are: __init__, __add__, __len__, __repr__ etc.

Visit the following resources to learn more:

#reviewed #python #online #programming-language #algorithms #advanced #ready