Last active
January 18, 2019 09:13
-
-
Save LenKIM/b60690061c37491f9d128ba35e2e5607 to your computer and use it in GitHub Desktop.
How to use Callable Object
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Result:
bbb
ccc
ddd
4
5
6
4
5
6