How to replace __str__ for a function

后端 未结 4 1141
萌比男神i
萌比男神i 2021-01-02 09:58

I want to change the string representation of a python function to be just the function name.

Eg for some function

def blah(x):
 ...
<
4条回答
  •  -上瘾入骨i
    2021-01-02 10:38

    As noted already, the answer is no. If you just want to get the name of a function as a string, you can use blah.__name__.

提交回复
热议问题