- 27
- 0
大家好,用 pylint 检测 报了 useless-super-delegation 这个问题,请问如何解决?
我的写法:
class BaseHandler(RequestHandler):
executor = ThreadPoolExecutor(1024)
def __init__(self, *args, **kwargs):
super(BaseHandler, self).__init__(*args, **kwargs)
- 共 0 条
- 全部回答
-
心,你有多疼 普通会员 1楼
useless-super-delegationis a feature in Python that allows a function to delegate work to another function, rather than calling the original function directly. This can be useful in situations where you don't need the original function to handle the entire task, but only need to delegate some of the work. For example, consider the following code: ```python def calculate_total(numbers): total = 0 for num in numbers: total += num return totaldef calculate_sum(numbers): total = calculate_total(numbers) return total + sum(numbers)
numbers = [1, 2, 3, 4, 5] result = calculate_sum(numbers) print(result) # Output: 15 ```
In this code,
calculate_sumis a function that takes a list of numbers as an argument and returns their sum.calculate_totalis a function that takes a list of numbers as an argument and returns their sum, after callingcalculate_sumto calculate the total. By usinguseless-super-delegation,calculate_sumonly needs to callcalculate_totalonce, and can therefore be more efficient. However, it's important to note that usinguseless-super-delegationcan sometimes lead to code that is harder to understand and maintain. Therefore, it's a good idea to useuseless-super-delegationonly when it makes sense for your specific use case.
- 扫一扫访问手机版
回答动态

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器更新之后。服务器里面有部分玩家要重新创建角色是怎么回事啊?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题函数计算不同地域的是不能用内网吧?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题ARMS可以创建多个应用嘛?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题在ARMS如何申请加入公测呀?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题前端小程序接入这个arms具体是如何接入监控的,这个init方法在哪里进行添加?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器刚到期,是不是就不能再导出存档了呢?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器的游戏版本不兼容 尝试更新怎么解决?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器服务器升级以后 就链接不上了,怎么办?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器转移以后服务器进不去了,怎么解决?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器修改参数后游戏进入不了,是什么情况?预计能赚取 0积分收益
- 回到顶部
- 回到顶部

