调用类方法时Python 虚拟机处理机制是什么,python机制,正在看一个在线教程 Da
调用类方法时Python 虚拟机处理机制是什么,python机制,正在看一个在线教程 Da
正在看一个在线教程 Data Structures and Algorithms with Object-Oriented Design Patterns in Python(http://www.brpreiss.com/books/opus7/)
在 http://www.brpreiss.com/books/opus7/ 中有这么一句:
“You should understand how the Python virtual machine determines the code to execute when a particular method is called。”
我对其中的virtual machine 不是特别理解, 所以这里感觉有点模糊,过来提问下,希望对python本身实现比较了解的同学,给解个惑:
1. virtual machine 是什么?
2. 提问标题:调用方法, virtual machine 会怎么做?
先说下自己的理解,因为这个章节提到了(类)继承,所以在调用方法, 假设该方法名为isTrue时,virtual machine 会先在当前类或者实例中查找是否有isTrue这个方法。若有,则执行其下的代码块;若无,则去当前类的基类中去检查是否有isTrue这个方法。之后重复此操作,直到元类.
编橙之家文章,
相关内容
- osx10.8.3编译vim74不成功求助,osx10.8.3编译vim74,我是按照
- 请问pthon动态规划多进程处理任务量是原理是什么,p
- django-socketio发送中文内容不乱码如何做,,Traceback (m
- python beautifulsoup获取本地文件标签不成功,,<script&g
- 求更新linux系统动态链接库usr\local\lib等方法,linuxusr,当
- 有人遇到过ubuntu软件中心不能打开的情况吗,遇到ubu
- Tkinter Label改变Label中文字样式用什么方法,tkinterlabel
- 请问gevent-socketio中resource与namespace具体作用如何,,问题
- python如何读取中文路径文件用什么命令,,一个python脚本
- 闲来没事翻译一篇python文档,有共同兴趣的朋友没,闲来
评论关闭