[Python-Dev] PEP 484: difference between tuple and ()
Jelle Zijlstra
jelle.zijlstra at gmail.com
Wed Nov 8 17:26:54 EST 2017
More information about the Python-Dev mailing list
Wed Nov 8 17:26:54 EST 2017
- Previous message (by thread): [Python-Dev] PEP 484: difference between tuple and ()
- Next message (by thread): [Python-Dev] Python 3.6.3 venv FAILURE
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
2017-11-08 14:01 GMT-08:00 Jean-Patrick Francoia < jeanpatrick.francoia at gmail.com>: > This is my first post on this list, so please don't kill me if I ask it in > the wrong place, or if the question is stupid. > > > I asked this question on Stack Overflow already: > > https://stackoverflow.com/questions/47163048/python- > annotations-difference-between-tuple-and > > > In very short, which form is correct ? > > > def func() -> Tuple[int, int] > > > > But this requires to import the typing module. > > > Or this (doesn't crash): > > > def func() -> (int, int): > > > The former is correct. Type checkers should reject the second one. But because type checking in Python is through static analysis, either will work at runtime—you need to run a separate static analysis tool like mypy or pytype to find type errors in your code. Also, python-dev is a mailing list for the development of Python, not for questions about Python. The Gitter chatroom at https://gitter.im/python/typing and the typing issue tracker at https://github.com/python/typing are better places for questions about typing in Python. > _______________________________________________ > Python-Dev mailing list > Python-Dev at python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: https://mail.python.org/mailman/options/python-dev/ > jelle.zijlstra%40gmail.com > > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20171108/36fe81bf/attachment.html>
- Previous message (by thread): [Python-Dev] PEP 484: difference between tuple and ()
- Next message (by thread): [Python-Dev] Python 3.6.3 venv FAILURE
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list