Python中文
首页
教程
问答
标签
搜索
登录
注册
Python3 interp中方法和类的位置
回答此问题可获得
20
贡献值,回答如果被采纳可获得
50
分。
<p>我们的教授今天告诉我们可以建立一个迭代器</p> <pre><code>class IteratorExample: def __init__(self, n): pass def __iter__(self): return self def __next__(self): if cond: pass else: raise StopIteration </code></pre> <p>当我们使用它时,比如在iteratorExample中的i中,解释器将调用iter(self)和next(self)方法。我的问题是:</p> <ol> <li>如果我打开C:\Python文件夹-在哪里可以看到调用这些方法的代码?你知道吗</li> <li>在python文件夹中,我在哪里可以看到其他内置方法(如len()或int())的代码?你知道吗</li> </ol>
0 条评论
分类:
Python问答
请先
登录
后评论
默认排序
时间排序
1 个回答
匿名
1天前
擅长:python、mysql、java
<p>你要求的是Python内置的行为。尤其是您使用的是用C编写的Python解释器,它通常被称为CPython。您可以找到CPython <a href="https://hg.python.org/cpython/file/1c51f1650c42" rel="nofollow">here</a>的源代码,尽管要找到执行<code>len()</code>、<code>int()</code>和迭代器协议的确切代码需要一些时间。你知道吗</p>
请先
登录
后评论
针对此问题:
更多的回答
关注
89
关注
收藏
1
收藏,
216
浏览
网友 提问于 2天前
相关Python问题
如何在乒乓球比赛中预测球的轨迹,对于AI球拍预测?
3 回答
如何在乒乓球游戏中阻止球
7 回答
如何在乘法和模中不乘空间?
9 回答
如何在乘法和除以2个不同的数字之间进行交换?
1 回答
如何在也是数据一部分的单个字符上拆分大字符串
1 回答
如何在乾草堆中找到針,有更好的解決方案嗎?
7 回答
如何在事件wxWidgets中传递自定义数据
9 回答
如何在事件中使用lambda i=i?
8 回答
如何在事件中心只接收最近的数据
3 回答
如何在事件发生之前保持云函数运行?
1 回答
如何在事件发生后使页面重定向到同一页面
5 回答
如何在事件回调之间保持python生成器的状态
7 回答
如何在事件处理程序(pythonsocket、sphinx)中保留docstring
1 回答
如何在事件处理程序中更改wxRichTextCtrl的光标位置?
8 回答
如何在事件处理程序中访问外部对象?
1 回答
如何在事件循环中将协程打包为正常函数?
4 回答
如何在事件循环之外运行协同程序?
7 回答
如何在事件循环结束时为并发未来的所有线程调用类方法?
1 回答
如何在事件文件中只保留一份摘要?
4 回答
如何在事件模板中添加事件
7 回答