Mar-15-2024, 08:35 AM
You can add methods to a class or replace existing methods with different code during runtime. I embed an interactive python interpreter in some of the systems I make. During debugging and checkout I can open a console to the interpreter a type python code. Sometimes I modify the code for a class so a method acts differently when called.
Modifying a class after it is included is rare, but common enough that there is a term for it: monkey patching.
Modifying a class after it is included is rare, but common enough that there is a term for it: monkey patching.