On 15 May 2012 23:32, Aaron Meurer <[email protected]> wrote:
> I had this idea before. See
> http://code.google.com/p/sympy/issues/detail?id=2006.
>
> I have no idea how hard it would be to implement, but my guess is that
> it wouldn't be easy. But if you have an idea how to do it go ahead and
> give it a shot. I think it would be really cool and very useful.
>
I have done it with a rather trivial change if it was not for
something that *totally* surprised me:
>>> Symbol('x')(1) # You will not believe what it returns
Function('x')(1) # Yes the symbol is transformed to a function
In [6]: x.__call__??
Type: instancemethod
Base Class: <type 'instancemethod'>
String Form:<bound method Symbol.__call__ of x>
Namespace: Interactive
File: /home/stefan/scientific_python_stack/sympy/sympy/core/symbol.py
Definition: x.__call__(self, *args)
Source:
def __call__(self, *args):
from function import Function
return Function(self.name)(*args)
May I please remove this feature if the tests do not fail?
The usual disclaimer: Maybe this feature (Symbol being a callable) is
necessary and I do not know the details. I will be happy to be
corrected.
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sympy?hl=en.