title: Using type hints to translate Python to Cython
body: <p>Type Hints now are available in Python 3.5 version. In the specification (<a href="https://www.python.org/dev/peps/pep-0484/" rel="noreferrer">PEP 484</a>) the goals (and the non-goals) are exposed clearly:</p>
  
  <blockquote>
    <h1>Rationale and Goals</h1>
    
    <blockquote>
      <p>This PEP aims to provide a standard syntax for type annotations, opening up Python code to easier static analysis and refactoring, potential runtime type checking, and (perhaps, in some contexts) code generation utilizing type information.
      [...]</p>
      
      <p>Of these goals, static analysis is the most important.</p>
    </blockquote>
    
    <h1>Non-goals</h1>
    
    <blockquote>
      <p>Using type hints for <strong>performance optimizations</strong> is left as an exercise for the reader.</p>
    </blockquote>
  </blockquote>
  
  <p>On the other hand, Cython has been using for a long time static syntax to improve performance. Usually, people rewrite some pieces of their code with Cython syntax, compile them, and then import them back as independent modules. It's a painful job do all that on a large code base. But the worst part is that even when you follow correctly all the above steps, you don't have any guarantee that you'll have a real improvement (because of compatibility problems that might be caused if you are using some modules). </p>
  
  <p>Would be a difficult task write a tool that <strong>uses this new type hints</strong> things scattered in the code to <strong>automatically translate them to Cython syntax</strong> and  possibly do the rest of the job (compile them into modules and import all them back)? It would be possible, therefore, to share the same language syntax in all the code base.</p>
  
  <p>Theoretically, it's possible to write a tool like that, but I'm not sure if be worth (in terms of complexity to write it and the real improvement that would be yield).</p>
  
  <p>Thanks. </p>