1 Feb 2005 06:26
type inference for python
Philippe Fremy <pfremy <at> inseal.com>
2005-02-01 05:26:29 GMT
2005-02-01 05:26:29 GMT
Hi, I would like to implement something similar to the type inference of ocaml for the python language. I have always found it very impressive (although I have only used caml light). I have no experience with the topic, it is just a project that seems cool to me(Continue reading)Do you have any hints or where I could build up my knowledge (code, books, article, ...) to do that kind of thing. I imagine that it works in a kind of three way pass: 1. analyse all the constraints of the code Ex: def f(a): a.append(1) def g(a): a=a+1; f(a) g('coucou') => a must support append => a must also be an int 2. cross-validate the constraints consistency => inconsistent assertions 3. validate the constraints against reality => g('coucou') will not work
Do you have any hints or where I could build up my knowledge (code,
books, article, ...) to do that kind of thing.
I imagine that it works in a kind of three way pass:
1. analyse all the constraints of the code
Ex:
def f(a): a.append(1)
def g(a): a=a+1; f(a)
g('coucou')
=> a must support append
=> a must also be an int
2. cross-validate the constraints consistency
=> inconsistent assertions
3. validate the constraints against reality
=> g('coucou') will not work

RSS Feed