为什么一提到编程语言中文化,就有那么多人反对呢?

2019-05-26 00:27:47 +08:00
 snake8090
刚接触 python 的小白,有点疑惑
为什么一提到中文编程,就有那么多人反对?
比如:用中文来定义变量,类,不是更容易理解吗?
毕竟我们的母语是中文,看到的第一事件就能明白是什么意思,如果是一个英文单词,还要想一下,我当初定义这个是干嘛用的?

例如下面这样,不是更好理解吗?


import pygame
from 飞机精灵 import *

pygame.init()

主窗口 = pygame.display.set_mode((512, 768))

背景 = pygame.image.load("./图片包 /草地背景.png")
英雄 = pygame.image.load("./图片包 /玩家飞机 1.png")

主窗口.blit(背景, (0, 0))
主窗口.blit(英雄, (205, 600))

pygame.display.update()

帧率 = pygame.time.Clock()

玩家位置 = pygame.Rect(205, 600, 102, 126)


敌机 1 = 飞机精灵("./图片包 /敌机.png")
敌机 2 = 飞机精灵("./图片包 /敌机.png", 3)

敌机组 = pygame.sprite.Group(敌机 1, 敌机 2)

while True:
# 设置游戏刷新率
帧率.tick(60)

for event in pygame.event.get():

if event.type == pygame.QUIT:
print("退出游戏......")

pygame.quit()
# exit()直接终止当前正在执行的程序
exit()


玩家位置.y -= 3


if 玩家位置.y < -126:
玩家位置.y = 768


主窗口.blit(背景, (0, 0))
主窗口.blit(英雄, 玩家位置)



敌机组.update()

敌机组.draw(主窗口)


pygame.display.update()


pygame.quit()



晚上闲着睡不着,随便问问,如果有什么认识不到位的地方,请多多指教!
9342 次点击
所在节点    问与答
133 条回复
chen2019
2019-05-26 16:12:53 +08:00
你既然要中文了 就中文好么。。。。 中文.英文() 个人受不了
charlie21
2019-05-26 16:36:27 +08:00
我对于这事的逻辑比较简单,只要 Python 不禁掉 utf-8 编码支持,那么中文编程就永远有人去做;不仅是中文编程有人去做,还有日语编程、韩语编程、俄语编程;你爱咋想咋想,爱怎么自己回避就怎么会回避、爱让其自生自灭就让其自生自灭,但是如果你把这些人杀了那么你要去坐牢、如果你把 Python,如果你用你的自由发言表达来促使它灭亡,那么别人可以自由发言说 诶 “用英文还用出优越感来了”

Python 社区于 2019 年 2 月选出的五人指导委员会:

Barry Warsaw
Brett Cannon
Carol Willing
Guido van Rossum
Nick Coghlan

他们没有将 “仅允许基本拉丁字母编程” 放入 python 语言特性,那么,我觉得,是有一定道理的
https://discuss.python.org/t/2019-steering-council-election-results/824

另外,看看 中蟒
```

載入 系統
文件名 = 系統.參數[1:]

定義 修正行尾(文件):
內文 = 打開(文件名).讀入()
內文 = 內文.替換('\n\r','\n')
傳回 內文

取 文件 自 文件名:
寫 修正行尾(文件)
</pre></blockquote>

```
它是一个典型的非拉丁字母编程,实际上这样的编程操作有很多,真的不止中文
https://en.wikipedia.org/wiki/Non-English-based_programming_languages


Based on non-English languages

Aheui; 아희 – An esoteric programming language similar to Befunge but using Hangul (Korean)[4]
AMMORIA – Open source object oriented Arabic programming language, designed especially for Arabs.[5]
Аналитик – A Russian-based language for symbolic manipulations with algebraic expressions used in the Soviet series of MIR computers.[6]
Эль-76 – A Russian-based language for symbolic manipulations with algebraic expressions used in the Soviet series of МВК Эльбрус computers.[7]
ARLOGO – The first open-source Arabic programming language, based on the UCB Logo interpreter.
AxumLight / Geez# – Amharic-based programming languages on the .NET platform[8]
丙正正 – Chinese C++.
BAIK – C with Indonesian keywords[9]
BASICOIS - BASIC with French keywords[10]
Bato – A scripting language based on the Filipino language (Tagalog). The first Filipino programming language.
Changjo – A language using Hangul (Korean). It is used for multimedia and game programming.
ChaScript – A scripting language based on Bengali and is first of its kind. It is built using ECMAscript grammar.[11][12]
Chinese BASIC – Chinese-localized BASIC dialects based on Applesoft BASIC; for Taiwanese Apple II clones and the Multitech Microprofessor II.
Chinese Python – a version of Python localized to Chinese.[13]
Dolittle, ドリトル – A Japanese programming language developed for educational purposes.[14]
DRAKON — A visual language in which any language may be used.
Drama [nl] – An assembly language for didactical purposes based on Dutch.
Dzintars – Ruby translated into Latvian; claims to be the first Latvian programming language.
Easy Programming Language (易语言) – A Chinese rapid application development language.
Ebda3 – A multi-paradigm high-level Arabic programming language.
Enkelt – A programming language that uses a Swedish syntax.
எழில், Ezhil programming language – A Tamil programming language developed for educational purposes.[15]
farsinet – A Persian (Farsi, فارسی, پارسی) object-oriented programming language for .NET framework. It is similar to C# and Delphi.
Fjölnir – An Icelandic imperative programming language of the 1980s.
FOCAL – Keywords were originally in English, but DEC produced versions of FOCAL in several European languages.
4th Dimension – On local versions, its internal language uses French or German keywords.
G-Portugol – A programming language with Portuguese keywords.[16]
GarGar – A Spanish procedural programming language based on Pascal for learning purposes.[17]
ΓΛΩΣΣΑ – A Greek programming language based on Pascal that is used for teaching purposes in secondary education.[18]
GOTO++ – A French esoteric programming language loosely based on French and English.[19]
ひまわり (プログラミング言語) [ja] ひまわり – Sunflower, a Japanese programming language.[20] It is used for hobby and business applications.
Hindawi Programming System – A set of variants of C, C++, lex, yacc, assembly, BASIC, Logo and Ada, in Bengali, Gujarati and Hindi.
Hindi Programming Language – A Hindi programming language for the .NET Framework.[21]
hForth – A Forth system with an optional Korean keyword set.[22]
Jeem ج – An Arabic programming language, based on C++ with simple graphics implementation.[1]
kalimat – An Arabic programming language that aims to help Arab children learn about programming.
Karel – An educational programming language with Czech and Slovak versions.
Kotodama on Squeak, ことだま on Squeak – A Japanese programming language based on Squeak for educational purposes.[23]
Kumir [ru] – A Russian-based programming language similar to Pascal and IDE, mainly intended for educational usage in schools. The name is an acronym, which means Комплект ученический 'Мир' ('Mir' student's environment).
Latino – A language with a completely Spanish-based syntax ( https://github.com/primitivorm/latino).
Linotte – A French programming language.
Logo – In one of its Apple II editions, it was available in French. LOGO for the Commodore 64 had an Italian localization.
Loughaty (MyProLang) – A general-purpose natural Arabic programming language based on a proprietary syntax.[24]
Lusus – A Latin programming language. It is the first programming language to be exclusively in Latin.[25]
LSE (Language Symbolique d'Enseignement) – a French, pedagogical, programming language designed in the 1970s at the École Supérieure d'Électricité. A kind of BASIC, but with procedures, functions, and local variables, like in Pascal.
Mama – An educational programming language and development environment, designed to help young students start programming by building 3D animations and games. It is currently available in English, Hebrew, Yiddish, and Chinese.
Mind – A Japanese programming language.[26] It is used for hobby and business applications.
MS Word and MS Excel – Their macro languages used to be localized in non-English languages.
ML4 – A language for client/server database programming, with keywords in English or German.[27]
Nadesiko, なでしこ – A Japanese programming language.[28][29]
1C:Enterprise – A Russian framework and language for business applications. English keywords can also be used.
Pauscal [es] – A language with a completely Spanish-based syntax; compiler for 32-bit Windows.
Lingua::Romana::Perligata – Alternative Syntax for Perl 5 that allows programming in Latin.
Phoenix – A C-like high-level imperative procedural Arabic programming language.[30]
potigol – A functional programming language in Portuguese for beginners.
PSeInt – A pseudocode interpreter for Spanish, like Pauscal, with a completely Spanish-based syntax. PSeInt is an abbreviation for Pseudocode Interpreter.
قلب (qlb) – An Arabic Scheme-like programming language exploring the role of human culture in coding.[31]
Qriollo – An impure strict functional programming language that compiles to C, Python and JVM Bytecode, with keywords in Rioplatense Spanish, spoken in Buenos Aires.[32]
Produire, プロデル – An object-oriented Japanese programming language.[33] It is used for hobby and business applications.
Rapira – A Russian-based interpreted procedural programming language with strong dynamic type system.
Robik [ru] – A simple Russian-based programming language for teaching basics of programming to children.
RoboMind – An educational programming language available in Arabic, Chinese, Dutch, English, French, German, Greek, Polish, Brazilian Portuguese, Spanish, Swedish, and Turkish.
SAKO – A language created in the 1950s and nicknamed the "Polish Fortran".
Scratch – An introductory visual programming language from MIT's Media Lab with support for programming in multiple languages included as standard.
Sema – An Arabic CSS implementation.[34]
Sí – A direct translation pseudo-language for coding in C and C++ with Spanish keywords.[35]
Simorgh (SPL) سیمرغ – An object-oriented, general-purpose, interpreted and precompiled, portable and open-source programming language.
Ssiat – A language using Hangul (Korean). The name Ssiat (씨앗) means "seed" in Korean.
Swaram – A simple, general-purpose and procedural language designed for programming in Tamil.[36]
Superlogo – A Dutch creation for computer-aided instruction, based on Logo.
TamliLogo – A Hebrew implementation of Logo.
TECO - The programming language used to drive the actions of the TECO text editor. The MIT dialect of this language was used to program early versions of Emacs before its 1985 rewrite in Emacs Lisp.
TI-Calculator BASIC – The 68000 version is localized. Unfortunately, various configuration strings are localized too, preventing direct binary compatibility.
TTSneo[2] – A Japanese programming language. It is used for hobby applications.
VisuAlg – A language designed to teach programming, in Portuguese, based in Pascal.
W-Language – A French programming language used in the WinDev CASE Tool. A Chinese version[37] is also available.
YMB (Yazyk mashin buchgalterskih) – ЯМБ (язык машин бухгалтерских) (machine language for accounting) – A Russian programming language for Iskra-554, Iskra-555, and Neva computers.
Yorlang – A Yorùbá programming language built on top of Node.js.[38]
ZhPy – A full-featured Python module which converts Chinese keywords, variables, and parameters.

见见世面,好么
JCZ2MkKb5S8ZX9pq
2019-05-26 16:46:11 +08:00
阿拉伯数字太难认了,高等数学的符号也太多了,把数学也中文化吧。
kwanzaa
2019-05-26 16:52:30 +08:00
输入法切换很蛋疼
yinjy
2019-05-26 17:10:56 +08:00
这是个伪问题,不论你用中文或英文做变量名或关键词,最总都变成机器码,
你直接用 define 把关键词改成中文,现在就可以实现中文编程
charlie21
2019-05-26 17:22:50 +08:00


“我用不上的 都是垃圾”



















“我用不上的 都是垃圾” 这只会显得你自己是____
charlie21
2019-05-26 17:26:19 +08:00
@qinxi 来请你思考一下问题本身
royrs
2019-05-26 17:42:48 +08:00
可以,但没必要。
masker
2019-05-26 18:09:14 +08:00
为什么不学易语言啊。易语言明显最适合你啊
SuperMild
2019-05-26 18:48:27 +08:00
每当提到中文编程就有很多人表示强烈反感,这个现象真的很奇怪。

有人说程序里有中文英文夹杂,看着很烦。但是,注意,普通英文编程的程序里,也有可能夹杂大量中文字符串啊!还有中文注释。

比如做前端的,这个 V 站的页面,大量中文,也是在代码里与英文混在一起。

有人说切换输入法麻烦,同理,中文字符串和中文注释也需要切换输入法,为什么大家就坦然接受?而对中文编程就强烈反感?

我看到很多人反对中文编程,但却没有看到很合理的理由。
0x3f3f
2019-05-26 19:06:26 +08:00
Talk is cheap. 尽管反对声音不断,支持者们还是可以继续努力的。去证明它,加油。
tetora
2019-05-26 19:59:21 +08:00
主要是缺少知名作品吧,有知名作品可以打 V2EX 90%的用户的脸
aWangami
2019-05-26 20:03:52 +08:00
要是 Github 的项目都是非英语在语言编码的,你会怎么想?
ipwx
2019-05-26 20:21:15 +08:00
中文字符之间加一堆英文标点、空格,那样的文本我感觉很丑。。。
bbq777aass
2019-05-26 20:25:28 +08:00
自己玩你随便,没人会反对吧?
话说回来,若日本人搞了个,马来人搞了个,法国人也搞了个,是否会让这个世界又多了些许隔阂?
英语已经成为了这个星球上最通用的语言,想改变的话,真得从几千年前做起。
secondwtq
2019-05-26 20:30:39 +08:00
@SuperMild 首先良好国际化的项目里面是不会出现零散的中文字符串常量的,注释就随便了,不过国际化的团队开发也是不会允许非英文注释的

不过这都是小问题,我看到的现象是,绝大多数讨论中文编程的都停留在简单翻译现有主流编程语言的表面上,并没有在方法论层面做出任何实质的创新(比 APL 之类的差远了),除了把几个单词翻译了一遍之外提供了什么额外的好处?哪里体现了中文特别的思想?所谓中文编程的 advocates 们就没有一个人去思考这些问题

https://zhuanlan.zhihu.com/p/66349646
wu67
2019-05-26 21:00:41 +08:00
编程语言我根本不管, 我只关心中文文档. 像某些人无脑推英文我就很反感, 像什么不用英文就是不与世界接轨、就是 low、连英文文档都看不懂都是垃圾...文化自信都被狗吃了
SuperMild
2019-05-26 21:17:44 +08:00
@secondwtq 为什么要上升到国际化和创新呢。

比如写小说和写技术书籍,通常都是用本地语言写,当需要国际化的时候再翻译,这个模式一直运作良好。

写技术博客也一样,很多人写的技术博客,其内容价值比 GitHub 上很多个人小项目都大,为什么没有人痛恨中文博客,说 “不够国际化”?

如果技术书籍、技术博客大量采用中文以及中英文夹杂,都没有惹人反感,那么写代码用了中文,怎么就特别招人厌呢。

即便是纯种英国人、美国人写代码,在给变量、类、函数取名时都会感到棘手,这是个很普遍的问题,而中国人,很大一部分程序员英文都不会十分好,取名用英文,很多时候只是看起来是英文,其实很可能是词不达意、歧义、拼写错误、中式英文、拼音、英语混合拼音等等……为了解决这个问题,用一个贴切的中文名,为什么会那么惹人反感。

我特别好奇这种心理。
zpf124
2019-05-26 21:46:12 +08:00
因为打字麻烦。
xinhangliu
2019-05-26 21:48:25 +08:00
累不累啊?

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/567694

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX