Delete callback interface

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Fixed
    • Priority: Major - P3
    • 2.0
    • Affects Version/s: None
    • Component/s: 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.

              Assignee:
              A. Jesse Jiryu Davis
              Reporter:
              A. Jesse Jiryu Davis
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: