call function example 2

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

View File

@ -0,0 +1,11 @@
class Sample:
def __init__(self, a):
self.a = a
def __call__(self, *args, **kwargs):
print('a = {}'.format(self.a))
print('args = {}'.format(args))
print('kwargs = {}'.format(kwargs))
s = Sample(100)
s(10, 20, 30, xx=40, yy=50) # eşdeğeri -> s.__call__(10, 20, 30, xx=40, yy=50)

View File

@ -0,0 +1,11 @@
class Sample:
def __init__(self, a):
self.a = a
def __call__(self, *args, *kwargs):
print('a = {}'.format(self.a))
print('args = {}'.format(args))
print('kwargs = {}'.format(kwargs))
s = Sample(100)
s(10, 20, 30, xx=40, yy=50) # eşdeğeri -> s.__call__(10, 20, 30, xx=40, yy=50)