简体   繁体   English

有什么方法可以查看Python 3模块中的源函数吗?

[英]Is there any way to see source functions in Python 3 Modules?

I'm fairly new to the language and am wondering if it's possible to see the functions that are being used in a certain Python 3 module? 我是该语言的新手,我想知道是否有可能看到某个Python 3模块中正在使用的功能?

Specifically the ones in the "ipaddress" module, thanks! 特别是“ ipaddress”模块中的那些,谢谢!

Is this what you are looking for? 这是你想要的?

https://docs.python.org/3/library/ipaddress.html https://docs.python.org/3/library/ipaddress.html

Generally, this type of information can be found in the languages docs. 通常,可以在语言文档中找到此类信息。


As mentioned by John in the comments, implementations can be found here: 正如John在评论中提到的,可以在这里找到实现:

http://hg.python.org/cpython/file/3.5/Lib/ipaddress.py http://hg.python.org/cpython/file/3.5/Lib/ipaddress.py

In addition to getting the source code online, if you have a standard Python install it should be already sitting in an easily found location on your hard-drive. 除了使源代码在线之外,如果您安装了标准的Python,则它应该已经位于硬盘驱动器上的容易找到的位置。 In my case it is found as a file in C:\\Python34\\Lib . 在我的情况下,可以在C:\\Python34\\Lib找到它作为文件。 Needless to say, if you go this route you need to be careful to not modify (or, even worse, delete) the file. 不用说,如果您采用这种方式,则需要注意不要修改(或更糟糕的是删除)文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM