Tag

Special Methods

0 views collected around this technical thread.

Test Development Learning Exchange
Test Development Learning Exchange
Jan 7, 2025 · Fundamentals

Understanding Classes and Objects in Python: Concepts, Inheritance, Special Methods, and Advanced Examples

This article introduces Python's class and object fundamentals, covering class definitions, instance and class variables, inheritance, special (dunder) methods, and advanced examples such as encapsulation, operator overloading, and the use of class and static methods, all illustrated with clear code snippets.

EncapsulationPythonSpecial Methods
0 likes · 10 min read
Understanding Classes and Objects in Python: Concepts, Inheritance, Special Methods, and Advanced Examples
Test Development Learning Exchange
Test Development Learning Exchange
Oct 30, 2024 · Fundamentals

Understanding Python Magic (Dunder) Methods: Definitions, Examples, and Best Practices

This article explains Python magic (dunder) methods, their purposes, common examples such as __init__, __str__, __repr__, __len__, __getitem__, __setitem__, __delitem__, __iter__, __call__, __add__, __eq__, __hash__, and shows how to implement operator overloading, iterator and context‑manager protocols while discussing naming rules, performance, inheritance, type checking, and limitations.

Context ManagerIterator ProtocolMagic Methods
0 likes · 19 min read
Understanding Python Magic (Dunder) Methods: Definitions, Examples, and Best Practices
Test Development Learning Exchange
Test Development Learning Exchange
Aug 3, 2024 · Fundamentals

Understanding Python Magic Methods: __bool__, __int__, __float__, __complex__, __index__, __oct__, __hex__, and __dir__

This article explains Python's special (magic) methods such as __bool__, __int__, __float__, __complex__, __index__, __oct__, __hex__, and __dir__, describing their purpose, how they affect object behavior, and provides concrete code examples demonstrating their usage and output.

Magic MethodsPythonSpecial Methods
0 likes · 5 min read
Understanding Python Magic Methods: __bool__, __int__, __float__, __complex__, __index__, __oct__, __hex__, and __dir__
Test Development Learning Exchange
Test Development Learning Exchange
Dec 13, 2023 · Fundamentals

Understanding Python Magic (Special) Methods with Practical Examples

This article explains Python's magic (special) methods such as __init__, __str__, __getitem__, __setitem__, __len__, __eq__, __iter__, __next__, __enter__, __exit__, __call__, and __del__, providing clear descriptions and runnable code examples for each in Python programming.

Magic MethodsPythonSpecial Methods
0 likes · 5 min read
Understanding Python Magic (Special) Methods with Practical Examples
Python Programming Learning Circle
Python Programming Learning Circle
Mar 22, 2021 · Fundamentals

Understanding Python Classes, Special Methods, Inheritance, and Polymorphism

This article explains Python's class definition, the role of the __init__ constructor, special methods like __repr__, __str__, and __add__, how inheritance and abstract base classes work, and demonstrates using super() for method chaining, providing clear code examples throughout.

PythonSpecial Methodsclasses
0 likes · 8 min read
Understanding Python Classes, Special Methods, Inheritance, and Polymorphism
Test Development Learning Exchange
Test Development Learning Exchange
Dec 27, 2019 · Fundamentals

Understanding Python's Special Methods __len__ and __getitem__ with Example Code

This article explains Python’s double‑underscore special methods such as __len__ and __getitem__, demonstrates their implementation in a FrenchDeck class with example code, shows how they enable built‑in functions like len() and indexing, and further illustrates additional dunder methods using a Vector class.

DunderExample CodePython
0 likes · 4 min read
Understanding Python's Special Methods __len__ and __getitem__ with Example Code