__call__ considered harmful or indispensable?
Paul Rubin
http
Thu Aug 2 16:27:57 EDT 2007
skip at pobox.com writes:
> In this particular case it was clearly unnecessary and just obfuscated the
> code. I'm wondering, are there some general cases where __call__ methods of
> a user-defined class are simply indispensable?
I don't know about "indispensable" but __call__ is convenient sometimes
and I do use it. I've wished that modules supported call, so I could
say
import foo
x = foo(3)
instead of having to say x=foo.foo(3) or something like that.
More information about the Python-list
mailing list