>>> Is the syntax for this stuff set in stone? I'm not sure I like the >>> equality inside the subs call. Equality is reflexive, but >>> substitution is a one way operation. What about a dictionary, sage: (a >>> +2*b).subs({a+b:x}), or even just a single equal sign, like keyword >>> args, sage: (a+2*b).subs(a+b=x). The double equals would work too, >>> but now is probably a better time for discussion than later. >> >> I am also in favor of the dictionary and/or keyword arguments (which are >> equivalent from the programming pov). This is also the current >> interface for other subs functions in Sage. >> >> I realized that William had already wrapped these functions right after >> I wrote the message saying I'll get to it soon. Though when I tried >> using them, I expected them to work with keyword arguments, and had to >> look in the docs. >> >> I suggest we change this back to be consistent with the already >> existing objects in Sage. >> >> Comments? > > Yes, definitely definitely change subs to take a dictionary and also **args, > just like the current calculus subs! > > I think it might be good to leave in an _subs method that > works with relationals as input. The *only* reason I implemented > something taking relationals as input is that I was simply directly wrapping > the > GiNaC api as is, and doing so pretty much in autopilot after about 15 hours > of nonstop coding. I don't think it's actually a good idea. That said, > maybe there is some value to at least providing a direct way to use that > function in the "GiNaC way".
Yep, sympy also uses dicts in .subs(), e.g. .subs({x: 2, y: z}) and also .subs(old, new). It has proven very handy. Ondrej --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---