| 1 | What are 'magic methods' (dunder methods) in Python, and why are they called that? Python › Magic Methods & Operator Overloading | Python | Magic Methods & Operator Overloading | Beginner |
| 2 | How do comparison magic methods like __lt__, __le__, __gt__, and __ge__ support custom sorting? Python › Magic Methods & Operator Overloading | Python | Magic Methods & Operator Overloading | Intermediate |
| 3 | How do context manager magic methods __enter__ and __exit__ work, and what does __exit__'s return value control? Python › Magic Methods & Operator Overloading | Python | Magic Methods & Operator Overloading | Advanced |
| 4 | How do __iadd__ and other in-place operator methods (__isub__, __imul__) differ from their non-in-place counterparts? Python › Magic Methods & Operator Overloading | Python | Magic Methods & Operator Overloading | Advanced |
| 5 | How does __slots__ interact with magic methods and instance attribute storage? Python › Magic Methods & Operator Overloading | Python | Magic Methods & Operator Overloading | Advanced |
| 6 | What is the difference between __str__ and __repr__? Python › Magic Methods & Operator Overloading | Python | Magic Methods & Operator Overloading | Beginner |
| 7 | How do you overload arithmetic operators like + and - using __add__ and __sub__? Python › Magic Methods & Operator Overloading | Python | Magic Methods & Operator Overloading | Intermediate |
| 8 | How does __contains__ let you customize the behavior of the 'in' operator? Python › Magic Methods & Operator Overloading | Python | Magic Methods & Operator Overloading | Intermediate |
| 9 | How does __repr__ help with debugging when printing a list of custom objects? Python › Magic Methods & Operator Overloading | Python | Magic Methods & Operator Overloading | Beginner |
| 10 | What do __eq__ and __hash__ need to satisfy together, and what happens if you only override __eq__? Python › Magic Methods & Operator Overloading | Python | Magic Methods & Operator Overloading | Intermediate |
| 11 | How do __len__, __getitem__, and __setitem__ let a custom class act like a sequence or mapping? Python › Magic Methods & Operator Overloading | Python | Magic Methods & Operator Overloading | Intermediate |
| 12 | How does __call__ let an instance of a class be invoked like a function? Python › Magic Methods & Operator Overloading | Python | Magic Methods & Operator Overloading | Intermediate |
| 13 | How do you implement custom attribute access with __getattr__ versus __getattribute__? Python › Magic Methods & Operator Overloading | Python | Magic Methods & Operator Overloading | Intermediate |
| 14 | What is the difference between __new__ and __init__, and when would you override __new__? Python › Magic Methods & Operator Overloading | Python | Magic Methods & Operator Overloading | Advanced |
| 15 | How does __bool__ (or the legacy __nonzero__) determine an object's truthiness, and what's the fallback if it's not defined? Python › Magic Methods & Operator Overloading | Python | Magic Methods & Operator Overloading | Advanced |
| 16 | What is a descriptor, and which dunder methods define the descriptor protocol? Python › Descriptors & Properties | Python | Descriptors & Properties | Intermediate |
| 17 | How does functools.total_ordering reduce boilerplate for comparison methods? Python › functools & Functional Programming Tools | Python | functools & Functional Programming Tools | Intermediate |
| 18 | How do you implement a custom __eq__ or __hash__ on a dataclass while still benefiting from its other auto-generated methods? Python › Dataclasses & NamedTuples | Python | Dataclasses & NamedTuples | Advanced |
| 19 | How does Python's own implementation of instance methods use the descriptor protocol to achieve automatic 'self' binding? Python › Descriptors & Properties | Python | Descriptors & Properties | Advanced |
| 20 | What does the @dataclass decorator automatically generate for a class? Python › Dataclasses & NamedTuples | Python | Dataclasses & NamedTuples | Beginner |
| 21 | What does the @property decorator do, and how does it let a method be accessed like an attribute? Python › Descriptors & Properties | Python | Descriptors & Properties | Beginner |
| 22 | What is the difference between an iterable and an iterator in Python? Python › Iterators & the Iterator Protocol | Python | Iterators & the Iterator Protocol | Beginner |
| 23 | What is multiple inheritance in Python, and how does it differ from single inheritance? Python › Multiple Inheritance & MRO | Python | Multiple Inheritance & MRO | Beginner |
| 24 | Why must dictionary keys (and set elements) be hashable, and what makes an object hashable in Python? Python › Data Types & Structures | Python | Data Types & Structures | Intermediate |
| 25 | How do you make a dataclass immutable (read-only after creation) using frozen=True? Python › Dataclasses & NamedTuples | Python | Dataclasses & NamedTuples | Intermediate |
| 26 | How do you write a decorator as a CLASS instead of a function, implementing __call__? Python › Decorators | Python | Decorators | Intermediate |
| 27 | What is the difference between a data descriptor and a non-data descriptor, and how does this affect attribute lookup priority? Python › Descriptors & Properties | Python | Descriptors & Properties | Intermediate |
| 28 | How does __set_name__ let a descriptor automatically learn the attribute name it's being assigned to on the owning class? Python › Descriptors & Properties | Python | Descriptors & Properties | Intermediate |
| 29 | How does @functools.wraps preserve metadata when writing decorators? Python › functools & Functional Programming Tools | Python | functools & Functional Programming Tools | Intermediate |
| 30 | How does Python know whether to treat a for-in target as iterable, and what error occurs if it isn't? Python › Iterators & the Iterator Protocol | Python | Iterators & the Iterator Protocol | Intermediate |
| 31 | How does the built-in `object` class relate to every class's MRO, and why does it always appear last? Python › Multiple Inheritance & MRO | Python | Multiple Inheritance & MRO | Intermediate |
| 32 | How does frozenset differ from a regular set, and what specific use case does its immutability enable? Python › Data Types & Structures | Python | Data Types & Structures | Advanced |
| 33 | How do you use dataclasses.field(compare=False) or field(repr=False) to exclude a specific field from the auto-generated __eq__ or __repr__? Python › Dataclasses & NamedTuples | Python | Dataclasses & NamedTuples | Advanced |
| 34 | How do you implement custom ordering (<, <=, >, >=) for a dataclass using order=True, and what constraint does it place on field comparison? Python › Dataclasses & NamedTuples | Python | Dataclasses & NamedTuples | Advanced |
| 35 | How would you use dataclasses.replace() to create a modified copy of an immutable (frozen) dataclass instance? Python › Dataclasses & NamedTuples | Python | Dataclasses & NamedTuples | Advanced |
| 36 | When would you choose a NamedTuple over a @dataclass, and vice versa, given their overlapping use cases? Python › Dataclasses & NamedTuples | Python | Dataclasses & NamedTuples | Advanced |
| 37 | How does __class_getitem__ enable generic-looking syntax like MyClass[int]? Python › Metaclasses & Class Customization | Python | Metaclasses & Class Customization | Advanced |
| 38 | How does __instancecheck__ and __subclasscheck__ on a metaclass enable 'virtual subclassing' as used by collections.abc? Python › Metaclasses & Class Customization | Python | Metaclasses & Class Customization | Advanced |