Python equivalent of PHPs __call() magic method?

sdteeth

New Member
In PHP, I can do something like this:\[code\]class MyClass{ function __call($name, $args) { print('you tried to call a the method named: ' . $name); }}$Obj = new MyClass();$Obj->nonexistant_method(); // prints "you tried to call a method named: nonexistant_method"\[/code\]This would be handy to be able to do in Python for a project I'm working on (lots of nasty XML to parse, it'd be nice to turn it into objects and be able to just call methods. Does Python have an equivalent?
 
Back
Top