📌  相关文章
📜  给一个函数起一个名字 python 代码示例

📅  最后修改于: 2022-03-11 14:47:00.582000             🧑  作者: Mango

代码示例1
def my_function():
    pass

class MyClass(object):
    def method(self):
        pass

print(my_function.__name__)         # gives "my_function"
print(MyClass.method.__name__)      # gives "method"

print(my_function.__qualname__)     # gives "my_function"
print(MyClass.method.__qualname__)  # gives "MyClass.method"