4 ms·
The rationale to add non-ascii identifiers to Python: Python code is written by many people in the world who are not familiar with the English language, or eve
by d0mine 16y ago
The rationale to add non-ascii identifiers to Python:
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. </quote> http://www.python.org/dev/peps/pep-3131/ http://www.python.org/dev/peps/pep-3131/
$ python3 -c '水=1; print(水)'
1
But I also don't know anyone who is actually using them.
- vorg 16y agoIn this example, i.e. 'print(水)', the Unicode symbol is being used within a syntax designed specifically for an Ascii vocabulary. If the syntax is changed to allow '打水' instead of 'print(水)', where the language parser knows the single CJK token 打 has a standalone semantic, then needless spaces can be removed.
- nitrogen 16y agoRight now computer programs written in common languages are internationally readable. It's bad enough having a language barrier in normal human communication. Why do we want to extend the language barrier to code, too? I don't care if it's not English, but there needs to be an internationally-accepted base character set and language for selecting programming language keywords, and that character set needs to be roughly the size of ASCII.