On Dec 17, 2007, at 12:03 PM, Joel B. Mohler wrote: > On Monday 17 December 2007 11:41, William Stein wrote: >> This is *not* a bug. The is by design. Since f has no variables it >> is no longer >> implicitly callable: > > Sorry for the double reply. Perhaps I should be very explicit > about why I > think the current state is very error-prone (and hence, IMO, bad > design): > > sage: f=lambda n: t*(x-n*x) > sage: f(1) > 0 > sage: f(2) > -t*x > sage: f(2)(1,2) > -2 > sage: f(1)(1,2) > <type 'exceptions.ValueError'>: the number of arguments must be > less than or > equal to 0 > > It is so not obvious that f(2) and f(1) are different in any major > way. I can > imagine situations like the above cropping up in much more subtle > ways and > being totally inscrutable. So, in short, I believe that the > current design > makes __call__ nearly useless for serious programming beyond one- > liners. > However, if we had to make things callable explicitly, the variables, > variable order and all such things are perfectly clear.
FYI, there is a way to make explicitly callable functions. sage: f(x) = x*sin(0) sage: f(3) or sage: g = x*sin(0) sage: f = g.function(x) sage: f x |--> 0 > > Oh, and sorry for not being more involved in the discussion last > week about > this design -- I was far more concerned with factoring polys. > > -- > Joel > > > --~--~---------~--~----~------------~-------~--~----~ 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://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~----------~----~----~----~------~----~------~--~---