账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    pylint useless-super-delegation
    27
    0

    大家好,用 pylint 检测 报了 useless-super-delegation 这个问题,请问如何解决?

    我的写法:

    class BaseHandler(RequestHandler):

    executor = ThreadPoolExecutor(1024)
    
    def __init__(self, *args, **kwargs):
        super(BaseHandler, self).__init__(*args, **kwargs)

    0
    打赏
    收藏
    点击回答
        全部回答
    • 0
    • 心,你有多疼 普通会员 1楼

      useless-super-delegation is 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 total

      def 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_sum is a function that takes a list of numbers as an argument and returns their sum. calculate_total is a function that takes a list of numbers as an argument and returns their sum, after calling calculate_sum to calculate the total. By using useless-super-delegation, calculate_sum only needs to call calculate_total once, and can therefore be more efficient. However, it's important to note that using useless-super-delegation can sometimes lead to code that is harder to understand and maintain. Therefore, it's a good idea to use useless-super-delegation only when it makes sense for your specific use case.

    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部