Tag

descriptor

1 views collected around this technical thread.

Test Development Learning Exchange
Test Development Learning Exchange
Sep 24, 2024 · Fundamentals

Understanding Python super() and Method Resolution Order (MRO) with Advanced Examples

This article explains how Python's super() works by invoking the next class in the Method Resolution Order (MRO), demonstrates MRO behavior with multiple inheritance examples, and presents advanced techniques such as metaclasses, descriptors, class decorators, __slots__, and singleton patterns.

MROMultiple InheritancePython
0 likes · 8 min read
Understanding Python super() and Method Resolution Order (MRO) with Advanced Examples
Test Development Learning Exchange
Test Development Learning Exchange
Oct 15, 2023 · Fundamentals

Python Property Access and Descriptor Magic Methods

This article explains Python's property access protocols and descriptor mechanisms, demonstrating how to customize attribute behavior using special methods like __getattribute__ and __getattr__.

ProgrammingPythondescriptor
0 likes · 5 min read
Python Property Access and Descriptor Magic Methods
Python Programming Learning Circle
Python Programming Learning Circle
Mar 15, 2022 · Fundamentals

Implementing Lazy Properties in Python with Descriptors and @property

This article explains the concept of lazy initialization in Python, reviews the @property decorator, and provides two complete implementations—a descriptor class and a decorator function—to create lazy properties that compute a value only once and then cache it for subsequent accesses.

PerformancePythondescriptor
0 likes · 5 min read
Implementing Lazy Properties in Python with Descriptors and @property
Byte Quality Assurance Team
Byte Quality Assurance Team
Jun 23, 2021 · Fundamentals

Understanding Python Properties and Descriptors

This article explains Python's property decorator and descriptor protocol, showing how to turn methods into managed attributes, perform validation, compute derived values, and illustrates their implementation with clear code examples including a Student class, a custom descriptor, and a classmethod reimplementation.

Code ExamplePythondescriptor
0 likes · 8 min read
Understanding Python Properties and Descriptors