Category: New Python tutorial

python tutorials and learn python

Created with Sketch.

Python __new__

Python __new__   Summary: in this tutorial, you’ll learn about the Python __new__ method and understand how Python uses it to create a new object. Introduction to the Python __new__ method When you create an instance of a class, Python first calls the __new__() method to create the object and then calls the __init__() method…
Read more

Python Data vs. Non-data Descriptors

Python Data vs. Non-data Descriptors Summary: in this tutorial, you’ll learn the differences between data and non-data descriptors. Descriptors have two types: Data descriptors are objects of a class that implements __set__ method (and/or __delete__ method) Non-data descriptors are objects of a class that have the __get__ method only. Both descriptor types can optionally implement…
Read more

Python Descriptors

Python Descriptors Summary: in this tutorial, you’ll learn about Python descriptors, how descriptors work, and how to apply them more effectively. Introduction to the Python descriptors Suppose you have a class Person with two instance attributes first_name and last_name: class Person: def __init__(self, first_name, last_name): self.first_name = first_name self.last_name = last_name Code language: Python (python)…
Read more

Python mixin

Python mixin   Summary: in this tutorial, you’ll learn about Python mixin classes and how to use them to make the code reusable. What is a mixin in Python? A mixin is a class that provides method implementations for reuse by multiple related child classes. However, the inheritance is not implying an is-a relationship. A…
Read more

Python Multiple Inheritance

Python Multiple Inheritance Summary: in this tutorial, you’ll learn about Python multiple inheritances and how method order resolution works in Python. Introduction to the Python Multiple inheritances. When a class inherits from a single class, you have single inheritance. Python allows a class to inherit from multiple classes. If a class inherits from two or…
Read more

Python Dependency Inversion Principle

Python Dependency Inversion Principle Summary: in this tutorial, you’ll learn about the Python dependency inversion principle to make your code hi Introduction to the dependency inversion principle The dependency inversion principle is one of the five SOLID principles in object-oriented programming: S – Single responsibility Principle O – Open-closed Principle L – Liskov Substitution Principle I – Interface Segregation…
Read more

Python Interface Segregation Principle

Python Interface Segregation Principle Summary: in this tutorial, you’ll learn about the interface segregation principle and how to apply it in Python. Introduction to the interface segregation principle The interface segregation principle is one of five SOLID principles in object-oriented programming: S – Single responsibility Principle O – Open-closed Principle L – Liskov Substitution Principle I – Interface Segregation…
Read more

Python Liskov Substitution Principle

Python Liskov Substitution Principle Summary: in this tutorial, you’ll learn about the Liskov Substitution Principle and how to implement it in Python. Introduction to the Liskov substitution principle The Liskov substitution principle (LSV) is one of the five principles in the SOLID principles. The L in SOLID stands for the Liskov substitution principle. S – Single…
Read more

Python Open–closed principle

Python Open–closed principle Summary: in this tutorial, you’ll learn about the open-closed principle to extend the system without directly modifying existing code. Introduction to the open-closed principle The open-closed principle is one of the five principles in the SOLID principle. The letter O in the SOLID stands for the open-closed principle. S – Single Responsibility Principle…
Read more

Python Single Responsibility Principle

Python Single Responsibility Principle Summary: in this tutorial, you’ll learn about the single responsibility principle and how to implement it in Python. What is SOLID SOLID is an abbreviation that stands for five software design principles compiled by Uncle Bob: S – Single responsibility Principle O – Open-closed Principle L – Liskov Substitution Principle I – Interface Segregation Principle D –…
Read more