Monkey-patching a Python instance method

Dynamically adding or overwriting an instance method in Python is rarely needed, but it’s a good excuse to explore interesting aspects of the language that aren’t always well known: the descriptor protocol, types.MethodType and partial function applicatio…

Similar

Hardest logic puzzle ever (in Python)

The Labyrinth is a children’s movie. The main character is 16 years old, and solving a logic puzzle that will literally decide if she lives or dies. In fiction, characters are faced with realistic challenges: ones they can solve, even if they have to make... (more…)

Read more »