call function example 2
This commit is contained in:
parent
926b55fe24
commit
504135cd93
11
python-temel/call.function.2.py
Normal file
11
python-temel/call.function.2.py
Normal 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)
|
11
python-temel/call.function.2.py~
Normal file
11
python-temel/call.function.2.py~
Normal 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)
|
Loading…
Reference in New Issue
Block a user