原文在: PEP 3131 -- Supporting Non-ASCII Identifiers.python
Python2並不支持非ASCII碼標識符. PEP的全稱是Python Enhancement Proposal, 即Python加強提案. 這個3131提案建立於2007年5月. Python3於2008年12月發佈.ide
Rationale一節開篇明義, 指出 用母語命名標識符對代碼清晰度和可維護性的提升.翻譯
Python code is written by many people in the world who are not familiar with the English language, or even well-acquainted with the Latin writing system. Such developers often desire to define classes and functions with names in their native languages, rather than having to come up with an (often incorrect) English translation of the concept they want to name. By using identifiers in their native language, code clarity and maintainability of the code among speakers of that language improves.設計
下面列出了一些質疑和迴應. 其中:code
People claim that they will not be able to use a library if to do so they have to use characters they cannot type on their keyboards. However, it is the choice of the designer of the library to decide on various constraints for using the library: people may not be able to use the library because they cannot get physical access to the source code (because it is not published), or because licensing prohibits usage, or because the documentation is in a language they cannot understand. A developer wishing to make a library widely available needs to make a number of explicit choices (such as publication, licensing, language of documentation, and language of identifiers). It should always be the choice of the author to make these decisions - not the choice of the language designers.ci
簡要翻譯:開發
有人表示庫若是是其餘語言命名, 不懂這一語言的使用者就不會輸入API名了. 迴應是庫開發者有權根據須要進行設計, 這與其餘制約因素(版權,文檔是外文等等)相似. 開發者若是想要庫被最普遍地使用, 天然會考慮到全部這些因素. 而這, 應該是開發者的決定, 而不是語言設計者的.文檔
2017-11-30get