* Jarrad Hope <m...@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 | m...@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/

Attachment: pgp4AG6CNOPBS.pgp
Description: PGP signature

_______________________________________________
code-quality mailing list
code-quality@python.org
https://mail.python.org/mailman/listinfo/code-quality

Reply via email to