Understanding the Difference Between __new__ and __init__ in Python
In Python's object-oriented programming, __new__ is a rarely used method compared to __init__. While __init__ is commonly mistaken for a constructor, it's actually an initializer. The true instance creation happens in __new__.
class Publication(object):
def __init__(self, name):
super(Publication, self).__init__()
self.name ...
Posted on Tue, 02 Jun 2026 17:27:29 +0000 by OzRedBoy
Python Magic Functions: A Comprehensive Guide
In simple terms, Python magic functions (also known as dunder methods) are methods that have double underscores at the beginning and end of their names. When defined inside a class, the Python interpreter automatically invokes them in specific situations. This allows you to customize your classes for various operasions, tailored to your own use ...
Posted on Thu, 14 May 2026 06:56:22 +0000 by mwood_2k2