[Zope-Coders] Re: ZCTextIndex too sensitive
Casey Duncan
casey@zope.com
Thu, 12 Jun 2003 15:29:44 -0400
On Thu, 12 Jun 2003 14:02:57 +0200
Philipp von Weitershausen <philipp@weitershausen.de> wrote:
> Guido van Rossum wrote:
> >>But this should be ok:
> >>
> >>if callable(text):
> >> try:
> >> text.__call__
> >> except AttributeError:
> >> pass
> >> else:
> >> text = text()
> >
> >
> >In Python 2.2, yes.
> >
> >In Python 2.1.x, callable built-in objects don't necessarily have a
> >__call__ attribute. Example:
>
> Yes, but how likely is it that the field attribute of an object represented
> by text in the code above actually is a callable builtin object like len,
> zip, repr etc.?
Normal Function and method objects also lack __call__ in Python 2.1. However,
you could also add a test for im_func or something yucky like that...
-Casey