为了账号安全,请及时绑定邮箱和手机立即绑定

python3的继承与反射的疑问

base_http_handler.py  这个文件中的handle()方法中通过反射的方式调用do_GET()方法。
simple_http_handler.py  继承 base_http_handler.py ,重写do_GET()方法,
handle()方法调用的是子类 simple_http_handler.py 的do_GET()方法。

我的疑问是,下面的代码中的getattr()方法传入self,获取到的方法不应该是父类base_http_handler.py中的方法吗?
method = getattr(self, method_name)
method()

正在回答

举报

0/150
提交
取消

python3的继承与反射的疑问

我要回答 关注问题
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号