Design of sympy.Symbol

45 views
Skip to first unread message

Björn Dahlgren

unread,
Jan 26, 2016, 8:12:32 AM1/26/16
to sympy
I was just surprised by the undocumented behaviour of Symbol:

def __call__(self, *args):
   
from .function import Function
   
return Function(self.name)(*args)

this is bad style in my humble opinion. The implicit creation of another type (Function) is confusing
and very far from the zen of Python (explicit is bettter than implicit). Any it prevents duck-typing checks
using ``callable``. Do people find this useful? I think it should be discouraged and even deprecated.

Sartaj Singh

unread,
Jan 26, 2016, 8:18:35 AM1/26/16
to sy...@googlegroups.com
I agree. This could also introduce subtle bugs. Mixing functions and symbols doesn't look good. 

Aaron Meurer

unread,
Jan 26, 2016, 11:00:08 AM1/26/16
to sy...@googlegroups.com
Yeah, there's an open issue for it https://github.com/sympy/sympy/issues/3539. It's there so that sympify parsing of things like 'f(x)' works.

Aaron Meurer

On Tue, Jan 26, 2016 at 8:18 AM, Sartaj Singh <singhs...@gmail.com> wrote:
I agree. This could also introduce subtle bugs. Mixing functions and symbols doesn't look good. 

--
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+un...@googlegroups.com.
To post to this group, send email to sy...@googlegroups.com.
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAC%2BH8-HXdUqgSLknpg_P910FYcbtHWbq_X4NVkqktEbx2YnAPw%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages