On Sun, Apr 3, 2016 at 2:07 AM, Marko Rauhamaa <ma...@pacujo.net> wrote: > Chris Angelico <ros...@gmail.com>: > >> Yep! And the letters (thorn and eth) survive in a very few languages >> (Icelandic, notably). Fortunately, Python 3 lets you use it in >> identifiers. > > While it is fine for Python to support Unicode to its fullest, I don't > think it's a good idea for a programmer to use non-English identifiers. > > The (few) keywords are in English anyway. Imagine reading code like > this: > > for oppilas in luokka: > if oppilas.hylätty(): > oppilas.ilmoita(oppilas.koetulokset) > > which looks nauseating whether you are an English-speaker or > Finnish-speaker.
I disagree. I've spoken with people who've used that kind of bilingual hybrid in regular conversation. There's a channel I hang out on that mainly speaks Turkish, but some sentences are a Turkish-English hybrid; usually they use Turkish grammar (subject-object-verb), as that's the native language of most of the people there. A lot of Python's keywords are derived from English, yes, but once they've been abbreviated some, and have slid in meaning from their original words, they become jargon that can plausibly be imported into other languages. Words like "lambda" aren't English, so other Roman alphabet languages are at no disadvantage there; words like "def" might easily acquire back-formation justifications/mnemonics in other languages. It's only the words that truly are English terms ("while") that are problematic, and there's only a handful of those to learn. Of course, there's the whole standard library, which is written in English. You could translate that without breaking everything, but it'd be a big job. The main reason for permitting non-English identifiers is to let people synchronize on external naming conventions. Suppose you create a form (web or GUI or something) and ask a human to key in half a dozen pieces of information, and then do some arithmetic on them. In English, we can do this kind of thing: name = input("Object name: ") length = int(input("Length: ")) width = int(input("Width: ")) height = int(input("Height: ")) volume = length * width * height print("Volume of %s is: %d" % (name, volume)) Note how every piece of input or output is directly associated with a keyword, which is used as the identifier in the code. This is important; when you come to debug code like this (let's assume there's a lot more of it than this), you can glance at the form, glance at the code, and not have to maintain a mental translation table. This is why we use identifiers in the first place - to identify things! Okay. So far, so good. Let's translate all that into Russian. (I don't speak Russian, so the actual translation has been done with Google Translate. Apologies in advance if the Russian text here says something horribly wrong.) название = input("Название объекта: ") длина = int(input("Длина: ")) ширина = int(input("Ширина: ")) высота = int(input("Высота: ")) объем = длина * ширина * высота print("Объем %s равно %d" % (название, объем)) Its a hybrid of English function names and Russian text strings and identifiers. But if you force everyone to write their identifiers in English, all you get is a hybrid of English function names and identifiers and Russian text strings - no improvement at all! Or, more likely, you'll get this: nazvanie = input("Название объекта: ") dlina = int(input("Длина: ")) shirina = int(input("Ширина: ")) vysota = int(input("Высота: ")) obyem = dlina * shirina * vysota print("Объем %s равно %d" % (nazvanie, obyem)) Is that an improvement? I don't think so. Far better to let people write their names in any way that makes sense for their code. ChrisA -- https://mail.python.org/mailman/listinfo/python-list