Skip to content Skip to sidebar Skip to footer
Showing posts with the label Magic Methods

Why Is __getattribute__ Not Invoked On An Implicit __getitem__-invocation?

While trying to wrap arbitrary objects, I came across a problem with dictionaries and lists. Invest… Read more Why Is __getattribute__ Not Invoked On An Implicit __getitem__-invocation?

Reflected Greater Than Magic Methods

I am in need of a reflected magic method 'greater than' and there does not appear to be one… Read more Reflected Greater Than Magic Methods

Why Are Explicit Calls To Magic Methods Slower Than "sugared" Syntax?

I was messing around with a small custom data object that needs to be hashable, comparable, and fas… Read more Why Are Explicit Calls To Magic Methods Slower Than "sugared" Syntax?

Defining Magic Methods On Classes

I would like to define a single object that can be iterated over without having to create a class a… Read more Defining Magic Methods On Classes