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 <[email protected]> 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 [email protected].
> To post to this group, send email to [email protected].
> 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.

-- 
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 [email protected].
To post to this group, send email to [email protected].
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/CAKgW%3D6%2BkkR4-stsywa1P2cC0Q-MvUQWaycGtyTrFUqpPUJ7WNQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to