Sorry I have been so slow to follow this stuff up. This week has been crazy with personal stuff...
> Fredrik noted that the second syntax suggested by Brian is already > supported. Should we pursue a bindings method for the convenience > factor, or the the current Lambda notation good enough? > I was not aware of the Lambda class, and this does seem to satisfy the > need to specify positional arguments to me. It is slightly more > cumbersome than the bindings approach, but not too much so. Right > given the discussion so far I am thinking bindings may not add much > given what Lambda already provides. I too was not aware of the Lambda stuff in sympy. While I think it is good to have this, I do think the bindings approach has a number of advantages, that make it a compelling addition: * The bindings approach is much lighter weight (less cumbersome) * You don't have to create two separate objects (the original expression and the Lambda). * With bindings, the type of object remains the same. For implementing some types of algorithms, this could be important. For instance, maybe I just wrote a function that does something with a polynomial. But, if the polynomial arises from a Lambda, my method won't see that the Lambda is actually just a polynomial. This is exactly what I mean when I talk about functions and expressions being *too* different in Mathematica. * Bindings can also be created and used recursively: >>> f = x*y*z >>> f.bindings = (x,) >>> g = f(10) >>> g 10*y*z >>> g.bindings = (y, z) >>> g(2, 3) 60 and you still get a reasonable type at the end: >>> type(g) Mul Even if you did make Lambdas work recursively in this manner, you would end up with a nasty nested Lambda, rather than just a Mul. In my experience with CASs this way of working where I start with a multivariate expression and gradually evaluate different symbols in it is a common usage pattern - and sometimes it makes more sense conceptually to do this using a function call syntax. Cheers, Brian > > -Lance > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sympy-patches" group. To post to this group, send email to sympy-patches@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sympy-patches?hl=en -~----------~----~----~----~------~----~------~--~---