[ZODB-Dev] Persistent-derived class instances always callable
John Belmonte
jvb at prairienet.org
Fri Oct 17 23:39:57 EDT 2003
Tim Peters wrote:
> I'm unclear why it's needed -- in over a decade of programming Python, the
> first time I used callable() was when typing the last reply <wink>.
I have a function that generates XML elements from a list of (Name,
Content) tuples. Normally the element content is set to str(Content),
but if Content is a list I recurse, and if it is callable I call it and
use the result.
> As is, ExtensionClass instances truly are callable as far as Python is
> concerned (they have a tp_call slot, which Python calls), and trying to
> convince Guido that "well, ya, they're callable, but not in a sense that's
> always useful to this particular app, so Python should grow some other idea
> of 'callable' that does make sense to this app" is going to be a hard sell.
It sounds like callable() as it is is useless, which is probably why
you've never used it. I suppose in my case I could just try calling
every object and catch the TypeError.
-John
--
http:// if le.o /
More information about the ZODB-Dev
mailing list