请教一个类的初级问题

spaceman01 2019-11-08 11:42:44
from thinkbayes import Pmf

class Cookie(Pmf):
"""A map from string bowl ID to probablity."""

def __init__(self, hypos):
"""Initialize self.

hypos: sequence of string bowl IDs
"""
Pmf.__init__(self)
for hypo in hypos:
self.Set(hypo, 1)
self.Normalize()

这里的Pmf.__init__(self)是什么意思?在thinlbayes.py的class Pmf(_DictWrapper)里并没有__init__(self),而且self.Set(hypo, 1)的self应该
是_DictWrapper对象,而不是指的Cookie,那么def __init__(self, hypos):的self是哪个呢?这绕来绕去弄得我有点混乱。
...全文
16 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
jmzl 2019-11-08
  • 打赏
  • 举报
回复
多重继承,看到那个母体才知道怎么回事

37,719

社区成员

发帖
与我相关
我的任务
社区描述
JavaScript,VBScript,AngleScript,ActionScript,Shell,Perl,Ruby,Lua,Tcl,Scala,MaxScript 等脚本语言交流。
社区管理员
  • 脚本语言(Perl/Python)社区
  • IT.BOB
加入社区
  • 近7日
  • 近30日
  • 至今

试试用AI创作助手写篇文章吧