[Cython] CF based type inference

Vitja Makarov vitja.makarov at gmail.com
Tue May 21 12:26:35 CEST 2013


Hi!

Recently I've started work on new type inference engine. Now it's almost
ready and I want to discuss it.

It works like this: first infer type for each assignment then for whole
entry. It has some advantages over previous algorithm:
 - it handles assignment cycles, see test_swap() for example
 - it can infer type using info about assignments on the whole entry:

a = 1
b = a
a = "str"

a is python object and b is integer.

Here are testcases that show some new cases it can solve:
https://github.com/vitek/cython
/blob/_type_inference_new/tests/run/type_inference_new.pyx

Here is branch for it https://github.com/vitek/cython
/tree/_type_inference_new

-- 
vitja.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cython-devel/attachments/20130521/f27059f9/attachment.html>


More information about the cython-devel mailing list