[code-quality] Rebuilding AST with Astroid?
Florian Bruhin
me at the-compiler.org
Fri Apr 24 06:53:06 CEST 2015
* Jarrad Hope <me at jarradhope.com> [2015-04-24 09:52:20 +0700]:
> I see test_infer_arguments, which seems to test inference of function
> arguments based on their calls,
> it it possible to infer arguments based on their interaction with locals?
>
> for example
> def double(x):
> return(x * 2)
>
> I'd like to be able to walk the double function arguments and infer x
> is an int based on it's interaction with Const(int)
x could as well be a float. Or a string. Or anything with __mul__
implemented: (python3)
>>> class Foo:
... def __mul__(self, other):
... return 'x'
...
>>> def double(x):
... return x * 2
...
>>> f = Foo()
>>> d
Florian
--
http://www.the-compiler.org | me at the-compiler.org (Mail/XMPP)
GPG: 916E B0C8 FD55 A072 | http://the-compiler.org/pubkey.asc
I love long mails! | http://email.is-not-s.ms/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/code-quality/attachments/20150424/60681f34/attachment.sig>
More information about the code-quality
mailing list