Collection is defined like Iterable but actually isn't

pymongo/collection.py
image

??? If you define __iter__ python considers the object is Iterable. If you define it why __next__ raise an error? and why alias to next() if it will do nothing? I dont understand.

from typing import Iterable

import pymongo

mongo_client = pymongo.MongoClient("localhost", 27017)
db = mongo_client.database_1

print(db.user)
print(isinstance(db.user, Iterable))

try:
    print(list(db.user))
except Exception as e:
    print(e)

try:
    print(next(db.user))
except Exception as e:
    print(e)

try:
    print(db.user.next())
except Exception as e:
    print(e)

Output:

Collection(Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'database_1'), 'user')
Is iterable -> True
'Collection' object is not iterable
'Collection' object is not iterable
'Collection' object is not iterable

This was reported to the PyMongo team, see the responses here: https://jira.mongodb.org/browse/PYTHON-3084