Hi, On Tue, Feb 02, 2010 at 02:06:45PM +0000, [email protected] wrote: > To that end, I need to infer the type of program variables. I'd like > to use type inference of PyPy (for RPython).
Two warnings before you go any further (I guess you already know about it but it doesn't hurt repeating it): 1. You can't infer the type of most program variables in Python: http://codespeak.net/pypy/dist/pypy/doc/faq.html#can-pypy-compile-normal-python-programs 2. PyPy's type inference only works for RPython, not for Python programs. > I know there is a statement (x.knowntype) that given the type of the > arguments it gives the type of return variable, but I want to know if > it is also possible to access the type of local variables. In the RPythonAnnotator instance there is a dictionary called 'bindings' that maps local variables to the corresponding SomeXxx instances. What you don't get "out of the box" is the mapping from the real local variables in your Python source code -- only from Variable instances, which are produced by the flow object space. A bientot, Armin. _______________________________________________ [email protected] http://codespeak.net/mailman/listinfo/pypy-dev
