[Zope-Coders] ZCTextIndex too sensitive
Guido van Rossum
guido@python.org
Thu, 12 Jun 2003 14:21:22 -0400
> 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:
Python 2.1.3 (#8, Oct 1 2002, 10:44:41)
[GCC 2.95.3 19991030 (prerelease)] on linux2
Type "copyright", "credits" or "license" for more information.
>>> callable(len)
1
>>> len.__call__
Traceback (most recent call last):
File "<stdin>", line 1, in ?
AttributeError: __call__
>>>
--Guido van Rossum (home page: http://www.python.org/~guido/)