python-3.x - AttributeError:“超级”对象没有属性“word_weighting”
问题描述
我有一个超级班FTM
:
class FTM:
def __init__(self,word_weighting = 'normal'):
self.word_weighting = word_weighting
def get_sparse_global_term_weights(self, word_weighting):
pass
还有一个继承自的子类FTM
:
class FLSA(FTM):
def __init__(self, word_weighting='normal'):
super().__init__(word_weighting = word_weighting)
self.sparse_global_term_weighting = super().get_sparse_global_term_weights(word_weighting = super().word_weighting)
运行此代码,我收到以下错误:
AttributeError: 'super' object has no attribute 'word_weighting'
我已经初始化了属性。为什么我会收到此错误?
解决方案
推荐阅读
- powershell - 通过 ADO 管道执行 PowerShell Selenium 脚本时面临代理问题:远程服务器返回错误:(403)禁止
- amazon-web-services - Terraform 输入变量的最佳解决方案?
- reactjs - 在特定页面中反应隐藏菜单和页脚
- ios - 通过 FirebaseMessaging 背景消息显示 iOS 应用徽章
- c# - 使用 WebApplicationFactory 的模拟身份验证不起作用
- mysql - 如何在包含 SELECT 和 JOIN 语句且仅复制新条目的插入触发器后使用 MySQL?
- r - 将整个向量/列表绑定到 R 中数据帧的每一行的更好方法?
- express - 如果没有数据,EJS 条件仍会呈现 Bootstrap 表头
- bash - 进入管道中的下一阶段时删除了工件
- c - 调用 FD_ISSET 时未定义的行为