作者fuminfumin (fumin)
看板Python
标题[问题] python 自己跑出来的class method的问题
时间Sun Apr 8 13:28:16 2012
我目前在学习web.py,主要的问题是看到里面的一段程式码好像black magic
有问题的程式码在下面
https://github.com/webpy/webpy/blob/master/web/session.py
在第107行的地方,class Session 的 _load() method 里面
出现了 self.update(d) 这个程式码。
我的疑问是 class Session 从来都没有定义过 update() 这个 method,
为什麽可以呼叫这个没有被定义的 method。
我原本是猜想可能是前面一段 "class Session(object)" 继承了 object 这个 class 了
但是我 google 都没有找到 object 这个 class 有 update() 这个 method。
因此想请教一下这个 self.update() 到底是怎麽来的,谢谢。
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 60.198.43.151