Type hinting sqlalchemy query resultWhat's the canonical way to check for type in Python?How do I return multiple values from a function?How to determine a Python variable's type?What are the differences between type() and isinstance()?Determine the type of an object?SQLAlchemy ORDER BY DESCENDING?SQLAlchemy: What's the difference between flush() and commit()?can an an ORM column trigger a session flush in SQLAlchemy?How To Insert Relationship Object Data Into DB With SQLAlchemy?Python Type Hints ignored

Does static fire reduce reliability?

Where to place an artificial gland in the human body?

How important is a good quality camera for good photography?

If my business card says 〇〇さん, does that mean I'm referring to myself with an honourific?

How to handle aversion that derives from perceiving arrogance?

What should I say when a company asks you why someone (a friend) who was fired left?

What do teaching faculty do during semester breaks?

Which creatures count as green creatures?

Sitecore Powershell extensions module compatibility with Sitecore 9.2

how to add 1 milliseconds on a datetime string?

Would it be a good idea to memorize relative interval positions on guitar?

Book with a female main character living in a convent who has to fight gods

Company requiring me to let them review research from before I was hired

What is a reasonable time for modern human society to adapt to dungeons?

Does a grappled creature need to use an action to escape grapple if grappler is stunned?

How can I make sure my players' decisions have consequences?

Impact of throwing away fruit waste on a peak > 3200 m above a glacier

How may I shorten this shell script?

USA: Can a witness take the 5th to avoid perjury?

Should I describe a character deeply before killing it?

What was the rationale behind 36 bit computer architectures?

Explanation for a joke about a three-legged dog that walks into a bar

What exactly makes a General Products hull nearly indestructible?

Historicity doubted by Romans



Type hinting sqlalchemy query result


What's the canonical way to check for type in Python?How do I return multiple values from a function?How to determine a Python variable's type?What are the differences between type() and isinstance()?Determine the type of an object?SQLAlchemy ORDER BY DESCENDING?SQLAlchemy: What's the difference between flush() and commit()?can an an ORM column trigger a session flush in SQLAlchemy?How To Insert Relationship Object Data Into DB With SQLAlchemy?Python Type Hints ignored






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








2















I can't figure out what kind of object a sqlalchemy query returns.



entries = session.query(Foo.id, Foo.date).all()


The type of each object in entries seems to be sqlalchemy.util._collections.result, but a quick from sqlalchemy.util._collections import result in a python interpreter raises an ImportError.



What I'm ultimately trying to do is to type hint this function:



def my_super_function(session: Session) -> ???:
entries = session.query(Foo.id, Foo.date).all()
return entries


What should I put in place of ???? mypy (in this case) seems to be fine with List[Tuple[int, str]] because yes indeed I can access my entries like if they were tuples, but i can also access them with entry.date, for example.










share|improve this question




























    2















    I can't figure out what kind of object a sqlalchemy query returns.



    entries = session.query(Foo.id, Foo.date).all()


    The type of each object in entries seems to be sqlalchemy.util._collections.result, but a quick from sqlalchemy.util._collections import result in a python interpreter raises an ImportError.



    What I'm ultimately trying to do is to type hint this function:



    def my_super_function(session: Session) -> ???:
    entries = session.query(Foo.id, Foo.date).all()
    return entries


    What should I put in place of ???? mypy (in this case) seems to be fine with List[Tuple[int, str]] because yes indeed I can access my entries like if they were tuples, but i can also access them with entry.date, for example.










    share|improve this question
























      2












      2








      2








      I can't figure out what kind of object a sqlalchemy query returns.



      entries = session.query(Foo.id, Foo.date).all()


      The type of each object in entries seems to be sqlalchemy.util._collections.result, but a quick from sqlalchemy.util._collections import result in a python interpreter raises an ImportError.



      What I'm ultimately trying to do is to type hint this function:



      def my_super_function(session: Session) -> ???:
      entries = session.query(Foo.id, Foo.date).all()
      return entries


      What should I put in place of ???? mypy (in this case) seems to be fine with List[Tuple[int, str]] because yes indeed I can access my entries like if they were tuples, but i can also access them with entry.date, for example.










      share|improve this question














      I can't figure out what kind of object a sqlalchemy query returns.



      entries = session.query(Foo.id, Foo.date).all()


      The type of each object in entries seems to be sqlalchemy.util._collections.result, but a quick from sqlalchemy.util._collections import result in a python interpreter raises an ImportError.



      What I'm ultimately trying to do is to type hint this function:



      def my_super_function(session: Session) -> ???:
      entries = session.query(Foo.id, Foo.date).all()
      return entries


      What should I put in place of ???? mypy (in this case) seems to be fine with List[Tuple[int, str]] because yes indeed I can access my entries like if they were tuples, but i can also access them with entry.date, for example.







      python sqlalchemy mypy






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 26 at 15:45









      JPFrancoiaJPFrancoia

      1,1961 gold badge14 silver badges38 bronze badges




      1,1961 gold badge14 silver badges38 bronze badges






















          1 Answer
          1






          active

          oldest

          votes


















          1














          I too found it curious that the class couldn't be imported. The answer is pretty long as I've walked you through how I've worked it out, bear with me.



          Query.all() calls list() on the Query object itself:



          def all(self):
          """Return the results represented by this ``Query`` as a list.
          This results in an execution of the underlying query.
          """
          return list(self)


          ... where list will be iterating over the object, so Query.__iter__():



          def __iter__(self):
          context = self._compile_context()
          context.statement.use_labels = True
          if self._autoflush and not self._populate_existing:
          self.session._autoflush()
          return self._execute_and_instances(context)


          ... returns the result of Query._execute_and_instances() method:



          def _execute_and_instances(self, querycontext):
          conn = self._get_bind_args(
          querycontext, self._connection_from_session, close_with_result=True
          )

          result = conn.execute(querycontext.statement, self._params)
          return loading.instances(querycontext.query, result, querycontext)


          Which executes the query and returns the result of sqlalchemy.loading.instances() function. In that function there is this line which applies to non-single-entity queries:



          keyed_tuple = util.lightweight_named_tuple("result", labels)


          ... and if I stick a print(keyed_tuple) in after that line it prints <class 'sqlalchemy.util._collections.result'>, which is the type that you mention above. So whatever that object is, it's coming from the sqlalchemy.util._collections.lightweight_named_tuple() function:



          def lightweight_named_tuple(name, fields):
          hash_ = (name,) + tuple(fields)
          tp_cls = _lw_tuples.get(hash_)
          if tp_cls:
          return tp_cls

          tp_cls = type(
          name,
          (_LW,),
          dict(
          [
          (field, _property_getters[idx])
          for idx, field in enumerate(fields)
          if field is not None
          ]
          + [("__slots__", ())]
          ),
          )

          tp_cls._real_fields = fields
          tp_cls._fields = tuple([f for f in fields if f is not None])

          _lw_tuples[hash_] = tp_cls
          return tp_cls


          So the key part is this statement:



          tp_cls = type(
          name,
          (_LW,),
          dict(
          [
          (field, _property_getters[idx])
          for idx, field in enumerate(fields)
          if field is not None
          ]
          + [("__slots__", ())]
          ),
          )


          ... which calls the built in type() class which according to the docs:




          With three arguments, return a new type object. This is essentially a
          dynamic form of the class statement.




          And this is why you cannot import the class sqlalchemy.util._collections.result - because the class is only constructed at query time. I'd say that the reason for this is that the column names (i.e. the named tuple attributes) aren't known until the query is executed).



          From python docs the signature for type is: type(name, bases, dict) where:




          The name string is the class name and becomes the __name__ attribute;
          the bases tuple itemizes the base classes and becomes the __bases__
          attribute; and the dict dictionary is the namespace containing
          definitions for class body and is copied to a standard dictionary to
          become the __dict__ attribute.




          As you can see, the bases argument passed to type() in lightweight_named_tuple() is (_LW,). So any of the dynamically created named tuple types inherit from sqlalchemy.util._collections._LW, which is a class that you can import:



          from sqlalchemy.util._collections import _LW

          entries = session.query(Foo.id, Foo.date).all()
          for entry in entries:
          assert isinstance(entry, _LW) # True


          ... so I'm not sure whether it's good form to type your function to an internal class with the leading underscore, but _LW inherits from sqlalchemy.util._collections.AbstractKeyedTuple, which itself inherits from tuple. That's why your current typing of List[Tuple[int, str]] works, because it is a list of tuples. So take your pick, _LW, AbstractKeyedTuple, tuple would all be correct representations of what your function is returning.






          share|improve this answer


















          • 1





            This is why we need protocols.

            – Ilja Everilä
            Mar 27 at 6:50










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55361186%2ftype-hinting-sqlalchemy-query-result%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          I too found it curious that the class couldn't be imported. The answer is pretty long as I've walked you through how I've worked it out, bear with me.



          Query.all() calls list() on the Query object itself:



          def all(self):
          """Return the results represented by this ``Query`` as a list.
          This results in an execution of the underlying query.
          """
          return list(self)


          ... where list will be iterating over the object, so Query.__iter__():



          def __iter__(self):
          context = self._compile_context()
          context.statement.use_labels = True
          if self._autoflush and not self._populate_existing:
          self.session._autoflush()
          return self._execute_and_instances(context)


          ... returns the result of Query._execute_and_instances() method:



          def _execute_and_instances(self, querycontext):
          conn = self._get_bind_args(
          querycontext, self._connection_from_session, close_with_result=True
          )

          result = conn.execute(querycontext.statement, self._params)
          return loading.instances(querycontext.query, result, querycontext)


          Which executes the query and returns the result of sqlalchemy.loading.instances() function. In that function there is this line which applies to non-single-entity queries:



          keyed_tuple = util.lightweight_named_tuple("result", labels)


          ... and if I stick a print(keyed_tuple) in after that line it prints <class 'sqlalchemy.util._collections.result'>, which is the type that you mention above. So whatever that object is, it's coming from the sqlalchemy.util._collections.lightweight_named_tuple() function:



          def lightweight_named_tuple(name, fields):
          hash_ = (name,) + tuple(fields)
          tp_cls = _lw_tuples.get(hash_)
          if tp_cls:
          return tp_cls

          tp_cls = type(
          name,
          (_LW,),
          dict(
          [
          (field, _property_getters[idx])
          for idx, field in enumerate(fields)
          if field is not None
          ]
          + [("__slots__", ())]
          ),
          )

          tp_cls._real_fields = fields
          tp_cls._fields = tuple([f for f in fields if f is not None])

          _lw_tuples[hash_] = tp_cls
          return tp_cls


          So the key part is this statement:



          tp_cls = type(
          name,
          (_LW,),
          dict(
          [
          (field, _property_getters[idx])
          for idx, field in enumerate(fields)
          if field is not None
          ]
          + [("__slots__", ())]
          ),
          )


          ... which calls the built in type() class which according to the docs:




          With three arguments, return a new type object. This is essentially a
          dynamic form of the class statement.




          And this is why you cannot import the class sqlalchemy.util._collections.result - because the class is only constructed at query time. I'd say that the reason for this is that the column names (i.e. the named tuple attributes) aren't known until the query is executed).



          From python docs the signature for type is: type(name, bases, dict) where:




          The name string is the class name and becomes the __name__ attribute;
          the bases tuple itemizes the base classes and becomes the __bases__
          attribute; and the dict dictionary is the namespace containing
          definitions for class body and is copied to a standard dictionary to
          become the __dict__ attribute.




          As you can see, the bases argument passed to type() in lightweight_named_tuple() is (_LW,). So any of the dynamically created named tuple types inherit from sqlalchemy.util._collections._LW, which is a class that you can import:



          from sqlalchemy.util._collections import _LW

          entries = session.query(Foo.id, Foo.date).all()
          for entry in entries:
          assert isinstance(entry, _LW) # True


          ... so I'm not sure whether it's good form to type your function to an internal class with the leading underscore, but _LW inherits from sqlalchemy.util._collections.AbstractKeyedTuple, which itself inherits from tuple. That's why your current typing of List[Tuple[int, str]] works, because it is a list of tuples. So take your pick, _LW, AbstractKeyedTuple, tuple would all be correct representations of what your function is returning.






          share|improve this answer


















          • 1





            This is why we need protocols.

            – Ilja Everilä
            Mar 27 at 6:50















          1














          I too found it curious that the class couldn't be imported. The answer is pretty long as I've walked you through how I've worked it out, bear with me.



          Query.all() calls list() on the Query object itself:



          def all(self):
          """Return the results represented by this ``Query`` as a list.
          This results in an execution of the underlying query.
          """
          return list(self)


          ... where list will be iterating over the object, so Query.__iter__():



          def __iter__(self):
          context = self._compile_context()
          context.statement.use_labels = True
          if self._autoflush and not self._populate_existing:
          self.session._autoflush()
          return self._execute_and_instances(context)


          ... returns the result of Query._execute_and_instances() method:



          def _execute_and_instances(self, querycontext):
          conn = self._get_bind_args(
          querycontext, self._connection_from_session, close_with_result=True
          )

          result = conn.execute(querycontext.statement, self._params)
          return loading.instances(querycontext.query, result, querycontext)


          Which executes the query and returns the result of sqlalchemy.loading.instances() function. In that function there is this line which applies to non-single-entity queries:



          keyed_tuple = util.lightweight_named_tuple("result", labels)


          ... and if I stick a print(keyed_tuple) in after that line it prints <class 'sqlalchemy.util._collections.result'>, which is the type that you mention above. So whatever that object is, it's coming from the sqlalchemy.util._collections.lightweight_named_tuple() function:



          def lightweight_named_tuple(name, fields):
          hash_ = (name,) + tuple(fields)
          tp_cls = _lw_tuples.get(hash_)
          if tp_cls:
          return tp_cls

          tp_cls = type(
          name,
          (_LW,),
          dict(
          [
          (field, _property_getters[idx])
          for idx, field in enumerate(fields)
          if field is not None
          ]
          + [("__slots__", ())]
          ),
          )

          tp_cls._real_fields = fields
          tp_cls._fields = tuple([f for f in fields if f is not None])

          _lw_tuples[hash_] = tp_cls
          return tp_cls


          So the key part is this statement:



          tp_cls = type(
          name,
          (_LW,),
          dict(
          [
          (field, _property_getters[idx])
          for idx, field in enumerate(fields)
          if field is not None
          ]
          + [("__slots__", ())]
          ),
          )


          ... which calls the built in type() class which according to the docs:




          With three arguments, return a new type object. This is essentially a
          dynamic form of the class statement.




          And this is why you cannot import the class sqlalchemy.util._collections.result - because the class is only constructed at query time. I'd say that the reason for this is that the column names (i.e. the named tuple attributes) aren't known until the query is executed).



          From python docs the signature for type is: type(name, bases, dict) where:




          The name string is the class name and becomes the __name__ attribute;
          the bases tuple itemizes the base classes and becomes the __bases__
          attribute; and the dict dictionary is the namespace containing
          definitions for class body and is copied to a standard dictionary to
          become the __dict__ attribute.




          As you can see, the bases argument passed to type() in lightweight_named_tuple() is (_LW,). So any of the dynamically created named tuple types inherit from sqlalchemy.util._collections._LW, which is a class that you can import:



          from sqlalchemy.util._collections import _LW

          entries = session.query(Foo.id, Foo.date).all()
          for entry in entries:
          assert isinstance(entry, _LW) # True


          ... so I'm not sure whether it's good form to type your function to an internal class with the leading underscore, but _LW inherits from sqlalchemy.util._collections.AbstractKeyedTuple, which itself inherits from tuple. That's why your current typing of List[Tuple[int, str]] works, because it is a list of tuples. So take your pick, _LW, AbstractKeyedTuple, tuple would all be correct representations of what your function is returning.






          share|improve this answer


















          • 1





            This is why we need protocols.

            – Ilja Everilä
            Mar 27 at 6:50













          1












          1








          1







          I too found it curious that the class couldn't be imported. The answer is pretty long as I've walked you through how I've worked it out, bear with me.



          Query.all() calls list() on the Query object itself:



          def all(self):
          """Return the results represented by this ``Query`` as a list.
          This results in an execution of the underlying query.
          """
          return list(self)


          ... where list will be iterating over the object, so Query.__iter__():



          def __iter__(self):
          context = self._compile_context()
          context.statement.use_labels = True
          if self._autoflush and not self._populate_existing:
          self.session._autoflush()
          return self._execute_and_instances(context)


          ... returns the result of Query._execute_and_instances() method:



          def _execute_and_instances(self, querycontext):
          conn = self._get_bind_args(
          querycontext, self._connection_from_session, close_with_result=True
          )

          result = conn.execute(querycontext.statement, self._params)
          return loading.instances(querycontext.query, result, querycontext)


          Which executes the query and returns the result of sqlalchemy.loading.instances() function. In that function there is this line which applies to non-single-entity queries:



          keyed_tuple = util.lightweight_named_tuple("result", labels)


          ... and if I stick a print(keyed_tuple) in after that line it prints <class 'sqlalchemy.util._collections.result'>, which is the type that you mention above. So whatever that object is, it's coming from the sqlalchemy.util._collections.lightweight_named_tuple() function:



          def lightweight_named_tuple(name, fields):
          hash_ = (name,) + tuple(fields)
          tp_cls = _lw_tuples.get(hash_)
          if tp_cls:
          return tp_cls

          tp_cls = type(
          name,
          (_LW,),
          dict(
          [
          (field, _property_getters[idx])
          for idx, field in enumerate(fields)
          if field is not None
          ]
          + [("__slots__", ())]
          ),
          )

          tp_cls._real_fields = fields
          tp_cls._fields = tuple([f for f in fields if f is not None])

          _lw_tuples[hash_] = tp_cls
          return tp_cls


          So the key part is this statement:



          tp_cls = type(
          name,
          (_LW,),
          dict(
          [
          (field, _property_getters[idx])
          for idx, field in enumerate(fields)
          if field is not None
          ]
          + [("__slots__", ())]
          ),
          )


          ... which calls the built in type() class which according to the docs:




          With three arguments, return a new type object. This is essentially a
          dynamic form of the class statement.




          And this is why you cannot import the class sqlalchemy.util._collections.result - because the class is only constructed at query time. I'd say that the reason for this is that the column names (i.e. the named tuple attributes) aren't known until the query is executed).



          From python docs the signature for type is: type(name, bases, dict) where:




          The name string is the class name and becomes the __name__ attribute;
          the bases tuple itemizes the base classes and becomes the __bases__
          attribute; and the dict dictionary is the namespace containing
          definitions for class body and is copied to a standard dictionary to
          become the __dict__ attribute.




          As you can see, the bases argument passed to type() in lightweight_named_tuple() is (_LW,). So any of the dynamically created named tuple types inherit from sqlalchemy.util._collections._LW, which is a class that you can import:



          from sqlalchemy.util._collections import _LW

          entries = session.query(Foo.id, Foo.date).all()
          for entry in entries:
          assert isinstance(entry, _LW) # True


          ... so I'm not sure whether it's good form to type your function to an internal class with the leading underscore, but _LW inherits from sqlalchemy.util._collections.AbstractKeyedTuple, which itself inherits from tuple. That's why your current typing of List[Tuple[int, str]] works, because it is a list of tuples. So take your pick, _LW, AbstractKeyedTuple, tuple would all be correct representations of what your function is returning.






          share|improve this answer













          I too found it curious that the class couldn't be imported. The answer is pretty long as I've walked you through how I've worked it out, bear with me.



          Query.all() calls list() on the Query object itself:



          def all(self):
          """Return the results represented by this ``Query`` as a list.
          This results in an execution of the underlying query.
          """
          return list(self)


          ... where list will be iterating over the object, so Query.__iter__():



          def __iter__(self):
          context = self._compile_context()
          context.statement.use_labels = True
          if self._autoflush and not self._populate_existing:
          self.session._autoflush()
          return self._execute_and_instances(context)


          ... returns the result of Query._execute_and_instances() method:



          def _execute_and_instances(self, querycontext):
          conn = self._get_bind_args(
          querycontext, self._connection_from_session, close_with_result=True
          )

          result = conn.execute(querycontext.statement, self._params)
          return loading.instances(querycontext.query, result, querycontext)


          Which executes the query and returns the result of sqlalchemy.loading.instances() function. In that function there is this line which applies to non-single-entity queries:



          keyed_tuple = util.lightweight_named_tuple("result", labels)


          ... and if I stick a print(keyed_tuple) in after that line it prints <class 'sqlalchemy.util._collections.result'>, which is the type that you mention above. So whatever that object is, it's coming from the sqlalchemy.util._collections.lightweight_named_tuple() function:



          def lightweight_named_tuple(name, fields):
          hash_ = (name,) + tuple(fields)
          tp_cls = _lw_tuples.get(hash_)
          if tp_cls:
          return tp_cls

          tp_cls = type(
          name,
          (_LW,),
          dict(
          [
          (field, _property_getters[idx])
          for idx, field in enumerate(fields)
          if field is not None
          ]
          + [("__slots__", ())]
          ),
          )

          tp_cls._real_fields = fields
          tp_cls._fields = tuple([f for f in fields if f is not None])

          _lw_tuples[hash_] = tp_cls
          return tp_cls


          So the key part is this statement:



          tp_cls = type(
          name,
          (_LW,),
          dict(
          [
          (field, _property_getters[idx])
          for idx, field in enumerate(fields)
          if field is not None
          ]
          + [("__slots__", ())]
          ),
          )


          ... which calls the built in type() class which according to the docs:




          With three arguments, return a new type object. This is essentially a
          dynamic form of the class statement.




          And this is why you cannot import the class sqlalchemy.util._collections.result - because the class is only constructed at query time. I'd say that the reason for this is that the column names (i.e. the named tuple attributes) aren't known until the query is executed).



          From python docs the signature for type is: type(name, bases, dict) where:




          The name string is the class name and becomes the __name__ attribute;
          the bases tuple itemizes the base classes and becomes the __bases__
          attribute; and the dict dictionary is the namespace containing
          definitions for class body and is copied to a standard dictionary to
          become the __dict__ attribute.




          As you can see, the bases argument passed to type() in lightweight_named_tuple() is (_LW,). So any of the dynamically created named tuple types inherit from sqlalchemy.util._collections._LW, which is a class that you can import:



          from sqlalchemy.util._collections import _LW

          entries = session.query(Foo.id, Foo.date).all()
          for entry in entries:
          assert isinstance(entry, _LW) # True


          ... so I'm not sure whether it's good form to type your function to an internal class with the leading underscore, but _LW inherits from sqlalchemy.util._collections.AbstractKeyedTuple, which itself inherits from tuple. That's why your current typing of List[Tuple[int, str]] works, because it is a list of tuples. So take your pick, _LW, AbstractKeyedTuple, tuple would all be correct representations of what your function is returning.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 27 at 6:35









          SuperShootSuperShoot

          2,85311 silver badges27 bronze badges




          2,85311 silver badges27 bronze badges







          • 1





            This is why we need protocols.

            – Ilja Everilä
            Mar 27 at 6:50












          • 1





            This is why we need protocols.

            – Ilja Everilä
            Mar 27 at 6:50







          1




          1





          This is why we need protocols.

          – Ilja Everilä
          Mar 27 at 6:50





          This is why we need protocols.

          – Ilja Everilä
          Mar 27 at 6:50








          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55361186%2ftype-hinting-sqlalchemy-query-result%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript