Antoon Pardon wrote:
def bar(iterator): if iter(iterator) is iterator: ...
That's a way of finding out whether you can safely iterate over something more than once. If the object is already an iterator, applying iter() to it will return the same object, and iterating over it will consume it. You would only care if you're intending to iterate over it more than once, and you're not sure what kind of object you have. -- Greg -- https://mail.python.org/mailman/listinfo/python-list