I think that shows they would also help design cleaner APIs. One of the
motivations of solveset() was to give a more consistent return type
compared to solve(). They can also help avoid type confusions like
https://github.com/sympy/sympy/issues/16362
<https://github.com/sympy/sympy/issues/16362(type> (type confusions are
especially common around sets and booleans).

I'm a little sceptical how far type hints can get us for SymPy since most
functions just take an Expr and return an Expr. But I think it's worth
playing around with, and perhaps in some submodules it could be quite
helpful. Certainly having the annotations there won't be harmful, since
they don't actually do anything unless you pass them through the right
tools.

Aaron Meurer

On Thu, May 2, 2019 at 6:20 PM Oscar Benjamin <[email protected]>
wrote:

> On Thu, 2 May 2019 at 23:09, Ondřej Čertík <[email protected]> wrote:
> >
> > Once we drop Python 2.7, we should experiment with using the type
> annotation and MyPy to statically check (eventually) the whole code base. I
> think this will find bugs, improve the development experience and make it
> much easier to understand from reading the code what kind of argument a
> function expects.
>
> This would pick up bugs. It would also not be easy to introduce
> because so many SymPy functions have inconsistent return types. I'm
> not even sure what the full type spec for solve would be.
>
> --
> Oscar
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/CAHVvXxR7sbMKUa5ZpSLLqvkTJqTNAPONgoA9MZdKXPYL7B3j3Q%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAKgW%3D6LXxFj8ucPkmMcw%2Bj5eC53jJBxkhUj35gSi6pJm%3D%2BaacQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to