Skip to content

Instantly share code, notes, and snippets.

@LenKIM
Last active January 18, 2019 09:13
Show Gist options
  • Save LenKIM/b60690061c37491f9d128ba35e2e5607 to your computer and use it in GitHub Desktop.
Save LenKIM/b60690061c37491f9d128ba35e2e5607 to your computer and use it in GitHub Desktop.
How to use Callable Object
class Geek:
def __init__(self, bb, cc, dd) -> None:
super().__init__()
self.bb = bb
self.cc = cc
self.dd = dd
self.input = ""
self.print_go(bb, cc, dd)
def __call__(self, a, b, c):
print('--------')
print(a)
print(b)
print(c)
print('--------')
def print_go(self, bb, cc, dd):
print(bb)
print(cc)
print(dd)
def print_inner_go(self, a, b, c):
print(a)
print(b)
print(c)
def main_sub_module(a, b, c):
print(a)
print(b)
print(c)
return a,b,c
Geek(bb="bbb", cc="ccc", dd="ddd")(*main_sub_module(4,5,6))
@LenKIM
Copy link
Author

LenKIM commented Jan 18, 2019

Result:
bbb
ccc
ddd
4
5
6

4
5
6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment