我看到list的类定义代码里,所有的类方法都是pass。请问真正的这些类方法的实现代码在哪里?谢谢

来源:5-3 list中extend方法区别

慕斯6162786

2020-03-26

class list(object):
"""
Built-in mutable sequence.

If no argument is given, the constructor creates a new empty list.
The argument must be an iterable if specified.
"""
def append(self, *args, **kwargs): # real signature unknown
    """ Append object to the end of the list. """
    pass

如上,append的实现代码只有pass,真正实现是怎样的呢?以及怎么能看到呢?

写回答

1回答

bobby

2020-03-28

这一点在课程中讲解过,list是用c语言写的,也就是说你本来就无法看到python源码,之所以这里能看到这个源码,。这个是pycharm做的一些python文件,只是让我们看到有哪些接口而已,并不是源码

0
0

Python3高级核心技术97讲,高级进阶的必学课程

socket编程/多线程/多进程/线程池/asyncio并发编程/协程和异步IO

2131 学习 · 552 问题

查看课程