import functools
class api_export(object):
def __init__(self,*arg,**kwags):
self._api_name = kwags.get('api_name','hahaha')
self._a = arg[0]
self._b = arg[1]
def add(self):
return self._a + self._b
def show(self):
if self._api_name == 'hahaha':
print("the origin is None")
if self._api_name == 'hehehe':
print("hehehehehehe")
if self._api_name == 'pashan':
print("Would you like to climb the mountain with me?~")
one = functools.partial(api_export,3)
two = functools.partial(api_export,api_name = 'hahaha')
three = functools.partial(api_export,3,api_name = 'pashan')
functools partical的作用
最新推荐文章于 2022-04-16 10:10:26 发布