Callable-iterator is not callable ;-)
just at xs4all.nl
Sun Feb 9 13:06:25 CET 2003
In article <mailman.1044791844.1051.python-list at python.org>,
Roman Suzi <rnd at onego.ru> wrote:
> >>> re.finditer("[0-9]", text)(1)
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> TypeError: 'callable-iterator' object is not callable
> Interesting, why is it named callable then?
It's not the interator that is callable, it's an iterator _for_ a
callable. I agree it's confusing...
>>> print iter.__doc__
iter(collection) -> iterator
iter(callable, sentinel) -> iterator
Get an iterator from an object. In the first form, the argument must
supply its own iterator, or be a sequence.
In the second form, the callable is called until it returns the
More information about the Python-list