Skip to content Skip to sidebar Skip to footer

Using Type Hints To Translate Python To Cython

Type Hints now are available in Python 3.5 version. In the specification (PEP 484) the goals (and the non-goals) are exposed clearly: Rationale and Goals This PEP aims to provide

Solution 1:

Someone else just asked about 484 and Cython, PEP-484 Type Annotations with own types, and I responded with a thread from a couple of months back about 484 and numpy.

I have doubts about the suitability of this topic for Stackoverflow. It's a research topic,not a 'how do I solve this coding problem' question.

Based on limited reading, the type-hints in 484 are preliminary, and any use is limited to the code checker developed by the 484 authors. Py3 has had annotations for a long time, but I've seen very few examples of code that includes them. Certainly not in the numpy code that I focus on here.

Another point is that cython and numpy (and numba) are used with Py2 just as much, if not more, than Py3. So the latest bells-n-whistles in Py 3.5 are generally ignored by these users. The @ operator is the only recent addition that numpy users value.

You are welcome respond, but I may nominate this question for closure based on it being a duplicate or off topic.

The typing module is being developed at https://github.com/python/typing

mypy is the type checker based on 484, https://github.com/python/mypy (funny, ~/mypy is the directory where I put all my SO testing scripts.)

That's where cutting edge Python type checking work is being done, not here.

Post a Comment for "Using Type Hints To Translate Python To Cython"