What are type hints in Python 3.5?

后端 未结 5 1041
死守一世寂寞
死守一世寂寞 2020-11-21 11:01

One of the most talked about features in Python 3.5 is type hints.

An example of type hints is mentioned in this article and this o

5条回答
  •  盖世英雄少女心
    2020-11-21 11:48

    The newly released PyCharm 5 supports type hinting. In their blog post about it (see Python 3.5 type hinting in PyCharm 5) they offer a great explanation of what type hints are and aren't along with several examples and illustrations for how to use them in your code.

    Additionally, it is supported in Python 2.7, as explained in this comment:

    PyCharm supports the typing module from PyPI for Python 2.7, Python 3.2-3.4. For 2.7 you have to put type hints in *.pyi stub files since function annotations were added in Python 3.0.

提交回复
热议问题