On Aug 2, 4:27 pm, Paul Rubin <http://[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] 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.
I used to think that. Or, rather, I often thought that it'd be nice if a function or class could be imported like a module. These days I think it'd be enough if modules don't have the same name as any (public) objects they define. No more glob.glob, select.select, or time.time. It's ugly and potentially confusing. And if I were Polynesian I would keep thinking I was seeing plurals. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list