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

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

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?

Where Is The Python Documentation For The Special Methods? (__init__, __new__, __len__, ...)

Where is a complete list of the special double-underscore/dunder methods that can be used in classe… Read more Where Is The Python Documentation For The Special Methods? (__init__, __new__, __len__, ...)

Why Does Functools.lru_cache Not Cache __call__ While Working On Normal Methods

I have been trying to make functools.lru_cache instance specific as described in this answer, but t… Read more Why Does Functools.lru_cache Not Cache __call__ While Working On Normal Methods