call function example
This commit is contained in:
parent
264d33a7be
commit
926b55fe24
9
python-temel/call.function.py
Normal file
9
python-temel/call.function.py
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
class Sample:
|
||||||
|
def __call__(self, x, y):
|
||||||
|
print('call: {}, {}'.format(x, y))
|
||||||
|
return x + y
|
||||||
|
|
||||||
|
s = Sample()
|
||||||
|
result = s(10, 20)
|
||||||
|
print(result)
|
||||||
|
|
9
python-temel/call.function.py~
Normal file
9
python-temel/call.function.py~
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
class Sample:
|
||||||
|
def __call__(self, x, y):
|
||||||
|
print('call: {}, {}'.format(x, y))
|
||||||
|
return x + y
|
||||||
|
|
||||||
|
s = Sample()
|
||||||
|
result = s(10, 20)
|
||||||
|
print(result)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user