I do plan to do this after the next release. There are some details to work through in making something that works for all of Basic.
The Function model with eval works well but I'm not sure that it would work for everything else. I think that we need to move the logic that is currently in __new__ methods into an instance method so that a full instance is created and then doit is called. The problem with Function.eval is that it is a class method so it isn't easy for subclasses to override its behaviour without completely rewriting the method. On Fri, 8 Nov 2019 at 22:36, Aaron Meurer <asmeu...@gmail.com> wrote: > > This is related to the discussion here > https://github.com/sympy/sympy/issues/17280. > > I like the idea. The implementation of __new__ is often quite > confusing, and it isn't always clear if you are doing it correctly. > That's not to mention that most people aren't used to using __new__ in > Python. We already do basically this for Function subclasses, and it > works quite well. > > I would start by consolidating the __new__ logic and introducing the > new method (maybe we should reuse the eval() name from Function?). > Then once we have that working, we can look at adding new automatic > behavior to __new__ like the things you mentioned. > > Aaron Meurer > > On Fri, Nov 8, 2019 at 3:21 PM Francesco Bonazzi > <franz.bona...@gmail.com> wrote: > > > > Constructors are being overloaded many times in SymPy. > > > > The way a constructor is supposed to be written is quite standard, but > > there are so many ways they are being written and mis-written. > > > > Should we rather replace __new__ with something different (like, for > > example, _eval_new?) > > > > Advantages: > > > > external control over evaluate=True/False, > > standardized way of creating properties and storing variables, > > automatic sympification for all args, > > type checks at construction can be easily introduced. > > > > -- > > 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 sympy+unsubscr...@googlegroups.com. > > To view this discussion on the web visit > > https://groups.google.com/d/msgid/sympy/7270b2d3-f3d6-4f5e-98c8-dec79154f88a%40googlegroups.com. > > -- > 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 sympy+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sympy/CAKgW%3D6L1DPdnGbixKkiReGWfutUWiq%2Btxm0v48nTNX83dLPUjQ%40mail.gmail.com. -- 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 sympy+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAHVvXxRoYJYF%2BMcLzj4jCTKc_f07gpHk5X8nCyC9i98%3DnGsT8g%40mail.gmail.com.