Tuesday, August 31, 2021

Object Oriented Programming In Python

Object Oriented Programming In Python

Object-Oriented Programming is a fundamental programming paradigm based on the concepts of objects and classes that can perform certain operations through their methods. We'll get into more details about OOP in this notebook.

Note: For this notebook, one should have some understanding of objects and classes.

Python Classes

A class is more or less a blueprint of an object. A class defines all the attributes and methods a certain object can attain. For example, a class for a student could contain attributes such as name, date of birth, phone number etc. and also contain methods which could perform any desired operations on these attributes.

An important building block of the class is the class' constructor (i.e the __init__ method). This method is the default method called upon instantiation (creating an instance/object of that class) and is usually where we'll define our attributes..

Let us understand all the above through an example.

In [ ]:
class
(continued...)

from Planet SciPy
read more

No comments:

Post a Comment

TestDriven.io: Working with Static and Media Files in Django

This article looks at how to work with static and media files in a Django project, locally and in production. from Planet Python via read...