class ThreadFunc(object):
def __init__(self, func,args,name=''):
self.name = name
self.func = func
self.args = args
def __call__(self):
apply(self.func, self.args)
def __call__(self): apply(self.func, self.args) python中,这句话是什么意思啊,初学,谢谢大家
答案:3 悬赏:20 手机版
解决时间 2021-02-09 21:43
- 提问者网友:缘字诀
- 2021-02-09 12:30
最佳答案
- 五星知识达人网友:北方的南先生
- 2021-02-09 12:57
虽然我很聪明,但这么说真的难到我了
全部回答
- 1楼网友:春色三分
- 2021-02-09 14:29
apply(function, args[, keywords])
The function argument must be a callable object (a user-defined or built-in function or method, or a class object) and the argsargument must be a sequence. The function is called with args as the argument list; the number of arguments is the length of the tuple. If the optional keywords argument is present, it must be a dictionary whose keys are strings. It specifies keyword arguments to be added to the end of the argument list. Calling apply() is different from just calling function(args), since in that case there is always exactly one argument. The use of apply() is equivalent to function(*args, **keywords).
Deprecated since version 2.3: Use function(*args, **keywords) instead of apply(function, args, keywords) (see Unpacking Argument Lists).
你看看文档嘛。。。。就是当call这个object时调用self.func并且使用self.args给的参数。。
- 2楼网友:三千妖杀
- 2021-02-09 13:13
设置Python2中的内容,当__call__调用self.func时同时传入self.args的参数;
python3使用self.func(*self.args)
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯