为什么Python那么依靠"convention"?

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

为什么Python那么依靠"convention"?

#1

帖子 科学之子 » 2016-09-06 12:29

为什么Python那么依靠"convention"?
https://docs.python.org/3.4/tutorial/cl ... -variables
“Private” instance variables that cannot be accessed except from inside an object don’t exist in Python. However, there is a convention that is followed by most Python code: a name prefixed with an underscore (e.g. _spam) should be treated as a non-public part of the API (whether it is a function, a method or a data member). It should be considered an implementation detail and subject to change without notice.
尤其是它还自称是"very-high-level language"
虽然确实有一些高级语言的特性,但是这么依赖约定...有种用C的感觉...
感觉就好像C里可以用指针乱玩一样
回复