that is it is not it (logic in Python)
Terry Reedy
tjreedy at udel.edu
Fri Apr 1 13:39:47 EST 2005
"F. Petitjean" <littlejohn.75 at news.proxad.net> wrote in message
news:424d0be1$0$2882$626a14ce at news.free.fr...
>I want to know if iter(iterator) returns always its argument (when
> argument is an iterator)
By the strict definition of iterator (versus iterable) that requires that
as a condition to be an iterator, then yes. If you use a looser definition
of iterator, then perhaps not.
>>>> iterable = range(10)
>>>> it = iter(iterable)
>>>> that = iter(it)
>>>> that is it
> True # Good!
>>>> that is it is not it
This is equivalent to '(that is it) and (it is not it)' which is clearly
false.
> False # What ?
Reread the ref manual on chained comparison operators.
Terry J. Reedy
More information about the Python-list
mailing list