-
Type:
Improvement
-
Resolution: Fixed
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
One of Motor's messiest problems is how to support Futures alongside its original callback-based API:
# Old-fashioned:
def callback(result, error):
if error:
print(error)
else:
print(result)
def func():
motor_client.db.collection.insert_one({'_id': 1}, callback=callback)
# Modern:
@gen.coroutine
def func():
result = yield motor_client.db.collection.insert_one({'_id': 1})
# Contemporary:
async def func():
result = await motor_client.db.collection.insert_one({'_id': 1})
After a discussion with Tornado's maintainer I've decided that Motor 2.0 should drop the old-fashioned callback interface.
- is related to
-
MOTOR-251 Deprecate callback interface
-
- Closed
-