Gradvis typat Python med Cython.

In this report Cython, an experimental programming language which adds functionality to Python was studied. One of the functionalities added by Cython is optional static type annotations. How these optional static type declarations affect performance is the main focus of this report. The effect of these type annotations on type safety and software design aspects of Python was also studied, but to a lesser extent.To establish how static type annotations affect performance three test cases were designed. These test cases were then gradually typed in a number of versions with different amounts of static typing. Finally, the execution times of the different versions were measured.It was found that gradual typing using Cython is a excellent optimization strategy for some Python code, particularly numeric calculations. However, Cythons gradually typed type system can not fully be considered an alternative to popular staticly typed languages with respect to software design considerations.

[1]  Benjamin C. Pierce,et al.  Types and programming languages: the next generation , 2003, 18th Annual IEEE Symposium of Logic in Computer Science, 2003. Proceedings..

[2]  Curt J. Sampson Experience report: Haskell in the 'real world': writing a commercial application in a lazy functional lanuage , 2009, ICFP.

[3]  Mark Pilgrim,et al.  Dive Into Python , 2004, Apress.

[4]  Oscar Nierstrasz,et al.  On the Revival of Dynamic Languages , 2005, SC@ETAPS.

[5]  Travis E. Oliphant,et al.  Python for Scientific Computing , 2007, Computing in Science & Engineering.

[6]  J. Baltasar García Pérez-Schofield,et al.  Including both static and dynamic typing in the same programming language , 2010, IET Softw..

[7]  Yosi Ben-Asher,et al.  The effect of unrolling and inlining for Python bytecode optimizations , 2009, SYSTOR '09.

[8]  Martín Abadi,et al.  Dynamic typing in a statically-typed language , 1989, POPL '89.

[9]  Manish Vachharajani,et al.  Gradual typing with unification-based inference , 2008, DLS '08.

[10]  Alexander Schatten,et al.  Concepts and models for typing events for event-based systems , 2007, DEBS '07.

[11]  Mark Lutz,et al.  Learning Python , 1999 .

[12]  Stefan Behnel,et al.  Cython: The Best of Both Worlds , 2011, Computing in Science & Engineering.

[13]  G. G. Stokes "J." , 1890, The New Yale Book of Quotations.