Answers for "how to define a name in python"

2

give a function a name python

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"
Posted by: Guest on April-10-2020
0

how to create a custom function in python

def functionName(x):
  print(x)
Posted by: Guest on May-20-2020

Code answers related to "how to define a name in python"

Python Answers by Framework

Browse Popular Code Answers by Language