Op do 19 jul. 2018 16:03 schreef Eric Fahlgren <ericfahlgren@gmail.com>:______________________________On Thu, Jul 19, 2018 at 6:52 AM Michael Hall <python-ideas@michaelhall.tech> wrote: While I am aware of projects like Cython and mypy, it seems to make sense for CPython to allow optional enforcement of type hints, with compiler optimizations related to it to be used. While this would not receive the same level of performance benefits as using ctypes directly, there do appear to be various gains available here.Just to make sure I understand: In other words, they would no longer be "hints" but "guarantees". This would allow an optimizer pass much greater latitude in code generation, somehow or other.For purposes of illustration (this is not a proposal, just for clarification):@guaranteed_typesdef my_sqrt(x:c_double) -> c_double:...would tell the compiler that it's now possible to replace the general PyObject marshalling of this function with a pure-C one that only accepts doubles and woe be unto those who use it otherwise._________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/