2 Réponses
0
It is just the standard keyword or reserved word to define a function or method
0
def is keyword which defines functions and methods
def test():
pass
#this is function
class Test:
def test(self):
pass
#this is method
What's more, all definitions are evaluated before script is run, so all code defined in definition will be run:
def fun(x=print('test')):
pass
#output: test