原文在: PEP 3131 -- Supporting Non-ASCII Identifiers.

Python2并不支持非ASCII码标识符. PEP的全称是Python Enhancement Proposal, 即Python增强提案. 这个3131提案创建于2007年5月. Python3于2008年12月发布.

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.

下面列出了一些质疑和回应. 其中:

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.

简要翻译:

有人表示库如果是其他语言命名, 不懂这一语言的使用者就不会输入API名了. 回应是库开发者有权根据需要进行设计, 这与其他制约因素(版权,文档是外文等等)类似. 开发者如果想要库被最广泛地使用, 自然会考虑到所有这些因素. 而这, 应该是开发者的决定, 而不是语言设计者的.

2017-11-30

转载于:https://juejin.im/post/5d3d0abd51882571da36f1de

Python3选择支持非ASCII码标识符的缘由相关推荐

  1. RFC#2457——Rust 语言选择支持非 ASCII 码标识符在 GitHub 引发的激辩(二)

    难难难,道德玄,不对知音不可谈.对了知音谈几句,不对知音枉费舌尖! 书接上文,至 2018 年 6 月 5 日,RFC#2457刚创建三天,已看到了不少反对声.在非英语母语的参与者中,华人开发者群体尤 ...

  2. RFC#2457——Rust 语言支持非 ASCII 码标识符在 GitHub 引发的激辩(一)

    Everything from Python to C++ supports non-ASCII idents by default. It's the correct behaviour. -- G ...

  3. 跨平台传输中使用base64来保证非ascii码字符串的完整性

    首先,我们来看一个例子: byte[] b=new byte[]{2,9,43}; String ss=new String(b,"utf-8"); byte[] b1=ss.ge ...

  4. 计算机应用基础ascii码运算,自考计算机应用基础真题及答案

    自考本科的原则是宽进严出,考试难度不低,通过自考本科获得学历的考生都是真材实料地学习,所掌握的专业知识技能也是很充实的.下面是自考计算机应用基础真题及答案,仅供参考. 计算机应用基础自考真题 一.单项 ...

  5. python Unicode转ascii码的一种方法

    缘起 看到这样的数据:Marek Čech.Beniardá怎样变成相对应的ascii码呢 解决 import unicodedata s = u"Marek Čech" #(u表 ...

  6. HTML实体字符、ASCII码、URLEncoder、Base64、MD5

    HTML 字符实体 在 HTML 中,某些字符是预留的. 在 HTML 中不能使用小于号(<)和大于号(>),这是因为浏览器会误认为它们是标签. 如果希望正确地显示预留字符,我们必须在 H ...

  7. ASCII码 和 Base64编码

    ASCII编码 简介 ASCII码(American Standard Code for Information Interchange, 美国信息互换标准代码) 是基于拉丁字母的一套电脑编码系统, ...

  8. python3 字符串 转 ascii码

    在这里先解释一下ASCII,Unicode 和 UTF-8这三者的关系 最早出现的是ASCII,一共包含128个字符(一个字节可以表示256种状态,但第一位所有默认为0,所以只有128种).在接下来计 ...

  9. matlab报错问题处理,函数或变量无法识别,不受支持的符号、不可见的字符或非 ASCII 字符的粘贴———卸载之前

    matlab报错问题处理,, 文本字符无效.请检查不受支持的符号.不可见的字符或非 ASCII 字符的粘贴. matlab里面缺少自带函数处理办法: 1.比较好的方法是重装. 2.也可以缺哪个文件,就 ...

  10. html圣诞树代码_支持手机选择背景音乐圣诞树源码

    html圣诞树代码_支持手机选择背景音乐圣诞树源码小子在本地测试了下,圣诞树会根据音乐变化起来,挺好看的手机打开显示黑屏的问题,已经修复适配,上传服务器即可,如果加载慢就把远程js和css本地化或者更 ...

最新文章

  1. 基于GAN模型的生成人脸重构、返老还童、看见前世今生(Age Progression/Regression)
  2. 阶乘的累加(3.11)(Java)
  3. ctrlx不能剪切怎么回事_立式磨粉机产量越来越低是怎么回事?
  4. SCM-SVN集成服务器
  5. 【转】RocketMQ的一些特性(生产者消费者配置参数的含义)
  6. 【安全】一名安全数据科学家的日常生活
  7. 用算法“脱掉”女性衣服,这款AI应用被迫下架后再被全网封杀
  8. OpenShift 4 Hands-on Lab (5) - 用Build、Builder Trigger、Webhook构建和更新镜像
  9. 教你如何处理Zabbix添加key总是not supported
  10. C++ Sets(集合)
  11. POJ-2762 Going from u to v or from v to u?
  12. BZOJ1283 序列(费用流)
  13. violate原理,java内存模型,可见性,cache二级内存模型
  14. 切图具体需要切什么内容_网页制作中的切图是什么?什么是切图
  15. Word如何快速绘制你需要的作文稿纸
  16. Msm8960(APQ8064)平台的MSM-AOSP-kitkat编译适配(9):摄像头GPS传感器
  17. 微信公众号模板消息接口
  18. 贪心算法——皇后游戏(洛谷P2123)
  19. 帝国php漏洞,帝国cms远程代码执行漏洞-1
  20. CNC:CNC计算机数控系统技术之数控仿真宏程序代码讲解、案例应用集合之详细攻略

热门文章

  1. js高级编号笔记[新]-事件
  2. EJB3在JBoss5内集群探究
  3. 「leetcode」56. 合并区间【贪心算法】详细图解!
  4. MacBook Pro 如何删除多余专注模式?
  5. Dr.Cleaner pro for mac(系统清理和优化软件)
  6. javascript的array.some()和array.every()
  7. 数组前半部分和后半部分有序的全排序
  8. 《NLTK基础教程——用NLTK和Python库构建机器学习应用》——2.10 练习
  9. IronPython for ASP.NET 部署注意事项
  10. 改bug过程中的新发现,重新认识String trim方法