Re: [sympy] node.func.__name__ on UndefinedFunctions?

23 views
Skip to first unread message
Message has been deleted

Aaron Meurer

unread,
Apr 5, 2016, 2:11:06 PM4/5/16
to sy...@googlegroups.com
It works in that case too

In [62]: u = Function('u')

In [63]: u.__name__
Out[63]: 'u'

The important thing to note is that Function('u') creates *class*, not
an object. Roughly speaking, Function('u') is syntatic sugar for

class u(Function):
pass

(except it also sets the metaclass as UndefinedFunction)

In other words, if you have a = u(x), then a.func is u.

Aaron Meurer


On Tue, Apr 5, 2016 at 2:04 PM, Nico <nico.sc...@gmail.com> wrote:
> I need to get the name (as a string) of certain given functions, and I've
> typically done it like
> ```
> node.func.__name__
> ```
> That works, except for UndefinedFunctions. Is that an oversight? How to get
> the 'hello' from u in
> ```
> u = sympy.Function('hello')
> ```
> ?
>
> Cheers,
> Nico
>
> --
> 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/78c636a9-ee80-4e1f-a491-726fc8447f52%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Nico

unread,
Apr 5, 2016, 2:12:55 PM4/5/16
to sympy
Great, thanks!
Reply all
Reply to author
Forward
0 new messages