In PHP, I can do something like this:
class MyClass { function __call($name, $args) { print('you tried to call a the method named: ' . $name); } } $Obj = new MyClass(); $Obj->nonexistant_method();
It would be convenient to have this in Python for the project I'm working on (a lot of nasty XML for parsing, it would be nice to turn it into objects and be able to just call methods.
Does Python have an equivalent?
python php magic-methods
Keith Palmer Jr.
source share