<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 21 December 2014 at 09:55, Ludovic Gasc <span dir="ltr"><<a href="mailto:gmludo@gmail.com" target="_blank">gmludo@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>I'm only a simple Python developer, not a Type Hinting expert and I don't know if you already discuss about that somewhere, but:</div><div><br></div><div>With the future official support of Type Hinting in Python, is it means that CPython could use this pieces of information to store variables with more efficient data structures, not only check types ?</div><div><br></div><div>It could possible to have better performance one day with Type Hinting like you have with Cython (explicit types declaration) or PyPy (guessing types) ?</div></div></blockquote><br></div><div class="gmail_quote">The primary goals of the type hinting standardisation effort are improving program correctness (through enhanced static analysis) and API documentation (through clearer communication of expectations for input and output, both in the code, in documentation, and in IDEs). It should also allow the development of more advanced techniques for function signature based dispatch and other forms of structured pattern matching.<br></div></div><div class="gmail_extra"><br></div><div class="gmail_extra">From a performance perspective though, CPython already has a wide array of fast paths for particular builtin types - being able to communicate those assumptions more clearly won't automatically make it easier to speed them up further (or add more in a maintainable fashion). There's no *philosophical* objection to such changes (other than "simplicity is a virtue"), there's just a long track record of previous attempts like psyco and Unladen Swallow that make it clear that the problem is genuinely *hard*.<br><br>There's also the fact that with both Numba and PyPy now supporting selective JIT acceleration of decorated functions within the context of a larger CPython application, as well as Cython's existing support for precompilation as a C extension, the pattern of profiling to find performance critical areas, and finding ways to optimise those, now seems well established. (Hence my suggestion the other day that we could likely use an introductory how to guide on performance profiling, which could also provide suggestions for optimisation tools to explore once the hot spots have been found).<br></div><div class="gmail_extra"><br></div><div class="gmail_extra">Cheers,<br>Nick.<br><br></div><div class="gmail_extra">-- <br><div class="gmail_signature">Nick Coghlan   |   <a href="mailto:ncoghlan@gmail.com">ncoghlan@gmail.com</a>   |   Brisbane, Australia</div>
</div></div>