Making Non Callable Objects Callable

Christian Heimes lists at cheimes.de
Tue Oct 7 13:56:36 EDT 2008


exiquio wrote:
> I am trying to figure out if there is a way to make an object in
> python callable, modules in particular. I wrongly assume that defining
> '__call__' in the the objects __dict__ would work. Any help would be
> appreciated.

No, that doesn't work. Several magic methods (__*__) aren't looked up in 
__dict__ or through __getattr__().

Christian




More information about the Python-list mailing list