python官方教程的这段话是说先执行__init__.py还是先初始化__path__ ?

软件和网站开发以及相关技术探讨
回复
科学之子
帖子: 2284
注册时间: 2013-05-26 6:58
系统: Debian 9

python官方教程的这段话是说先执行__init__.py还是先初始化__path__ ?

#1

帖子 科学之子 » 2016-08-13 22:56

python官方教程的这段话是说先执行__init__.py还是先初始化__path__ ?
https://docs.python.org/3.4/tutorial/mo ... irectories
Packages support one more special attribute, __path__. This is initialized to be a list containing the name of the directory holding the package’s __init__.py before the code in that file is executed.
意思是说"在 __init__.py中的代码执行前,先初始化__path__"
还是说"在初始化__path__前,先执行__init__.py中的代码"?
头像
vickycq
帖子: 4507
注册时间: 2011-03-20 13:12
系统: Debian
来自: 山东省寿光县
联系:

Re: python官方教程的这段话是说先执行__init__.py还是先初始化__path__ ?

#2

帖子 vickycq » 2016-08-13 23:06

个人意见为前者。句子主干:__path__ is initialized before the code in __init__.py is executed.
Debian 中文论坛 - forums.debiancn.org
欢迎所有 Debian GNU/Linux 用户
回复