call function example

This commit is contained in:
Mert Gör 🇹🇷 2023-08-01 18:43:21 +03:00
parent 264d33a7be
commit 926b55fe24
No known key found for this signature in database
GPG Key ID: 2100A876D55B39B9
2 changed files with 18 additions and 0 deletions

View 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)

View 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)