4 ms·
Sometimes magic is necessary but these slides right here contain some serious voodoo. That said I've used monkey patching before which can be quite useful when
by jtchang 14y ago
Sometimes magic is necessary but these slides right here contain some serious voodoo.
That said I've used monkey patching before which can be quite useful when you don't want to change the underlying library too much but don't want to make a complete fork. Specifically I've monkey patched methods onto the User model in Django.
- mfieldhouse 14y agoWhat is meant by Python magic? What is and isn't magic? Why would you want to use it and why might it be considered a bad idea?
- marcus 14y agoMy definition of magic: Magic is anything which makes other code behave in a way that would require reading the magic to understand, despite not being apparent in the magicked code. Good because it makes many things a lot easier, bad because it makes code a lot less explicit and simple and increases cognitive load (you need to always consider the magic not just the current code you're looking at).