Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Chris Angelico Newsgroups: comp.lang.python Subject: Re: [beginner] What's wrong? Date: Sun, 3 Apr 2016 02:36:48 +1100 Lines: 97 Message-ID: References: <99234e90-fcd4-4a05-b97f-b47228dde20c@googlegroups.com> <1459571270.714249.566352882.6ADCD0CC@webmail.messagingengine.com> <87bn5sqcac.fsf@elektro.pacujo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: news.uni-berlin.de GaZ46ofFav6iWRGDn70TsgnAQVL1a2nPRu4JuNAzSYGQ== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:: [': 0.03; 'anyway.': 0.04; 'debug': 0.04; 'table.': 0.07; 'width': 0.07; 'cc:addr:python-list': 0.09; 'conventions.': 0.09; 'derived': 0.09; 'english,': 0.09; 'identifier': 0.09; 'imported': 0.09; 'survive': 0.09; "they've": 0.09; 'advance': 0.10; 'python': 0.10; 'assume': 0.11; 'english.': 0.13; 'output': 0.13; 'translate': 0.15; 'languages.': 0.15; '"def"': 0.16; '"lambda"': 0.16; '(name,': 0.16; '2016': 0.16; 'alphabet': 0.16; 'bilingual': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'identifiers': 0.16; 'identifiers.': 0.16; 'keyword,': 0.16; 'naming': 0.16; 'non-english': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:beginner': 0.16; 'wrote:': 0.16; 'translation': 0.16; 'library,': 0.18; 'gui': 0.18; 'programmer': 0.18; 'input': 0.18; 'language': 0.19; 'subject:] ': 0.19; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'so.': 0.22; "aren't": 0.22; 'suppose': 0.22; 'am,': 0.23; 'code,': 0.23; 'code.': 0.23; "python's": 0.23; 'this:': 0.23; 'words': 0.24; 'written': 0.24; 'header:In-Reply-To:1': 0.24; "i've": 0.25; 'sense': 0.26; 'chris': 0.26; 'external': 0.27; 'message- id:@mail.gmail.com': 0.27; 'pieces': 0.27; 'function': 0.28; 'idea': 0.28; 'skip:( 20': 0.28; 'actual': 0.28; 'fine': 0.28; 'looks': 0.29; 'regular': 0.29; 'arithmetic': 0.29; 'far,': 0.29; 'handful': 0.29; 'there.': 0.30; 'code': 0.30; 'everyone': 0.31; 'says': 0.32; 'good.': 0.32; 'usually': 0.33; 'lets': 0.33; 'skip:j 20': 0.33; 'skip:\xd0 10': 0.33; 'channel': 0.34; 'languages': 0.34; 'received:google.com': 0.35; 'could': 0.35; 'text': 0.35; 'done': 0.35; 'unicode': 0.35; 'something': 0.35; 'but': 0.36; 'skip:i 20': 0.36; 'received:209.85': 0.36; 'form,': 0.36; 'volume': 0.36; 'subject:?': 0.36; 'received:209.85.213': 0.37; 'associated': 0.38; 'received:209': 0.38; 'names': 0.38; 'or,': 0.38; 'speak': 0.38; 'google': 0.39; 'why': 0.39; 'easily': 0.39; 'some': 0.40; '8bit%:93': 0.60; 'hang': 0.60; "you'll": 0.61; 'information,': 0.61; 'identify': 0.61; 'more': 0.63; '8bit%:50': 0.66; 'here': 0.66; 'letters': 0.67; '8bit%:100': 0.70; 'russian': 0.76; '(web': 0.84; '8bit%:45': 0.84; 'all!': 0.84; 'chrisa': 0.84; 'everything,': 0.84; 'fortunately,': 0.84; "it'd": 0.84; 'learn.': 0.84; 'roman': 0.84; 'russian,': 0.84; 'turkish': 0.84; 'turkish,': 0.84; 'to:none': 0.91; '8bit%:70': 0.91; 'dozen': 0.91; 'glance': 0.91; 'important;': 0.91; 'speaks': 0.91; 'improvement': 0.93; 'imagine': 0.96 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-transfer-encoding; bh=lYmbeXVbYxv/N9cGTxtd56bn/GAGlnPkGsEEjM/7s5A=; b=uBpPIcHjp/rirc8/w2obYftgJJOMDOiYlsCtIaWPEuaB2x1oSWavvo1sngjoZWm9UA /HWM72krIIc0r7txy9N8sA3R+0+5VBUZ4p8T0gcOfRIDQ2l3iSCUzisA0kP0Y7xv74Ze S5Pm41xxRTGWjGgxO8G2g6N5GP9sb0zUGj9+67ceFihBjLk6NeUWJr2Zg6dFBA/6GPZx VqH8oRqX6N/2ETqcTtuZE/bjgnxbZ0+O4UmjffZUb+XfrMCJXhdTuARzE1J4V9QXoZwR cJJ1C81BuOgp6vDtAK7ks8/KS23tRcA8Zfucfu9O8QWc7oxmicLftiAzEhX4NY5L4xZ/ +sLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:cc:content-transfer-encoding; bh=lYmbeXVbYxv/N9cGTxtd56bn/GAGlnPkGsEEjM/7s5A=; b=ikEfVZQ1yg09LmHuV2JQOPRO2YiCr8p+MR9THbcw39Fdtf/yLzD53tGyfBqB/+ncIs /IikqPU9L6YN3f7jPfd7hKZ7zfqwJ55SwcncWbyUrCCjVescBTP3KWHRSVT8UNNOhWbD 4KHLaBN8h1WHeTe4Eti5tZYoEefcKPmAYd6kahyRqhkK/lyxihTYSTEfcWSWYcArl98o 7HVyTIhxqQLld8Esf/UtymQPE7jtdny3owRRgnjjWAiF1hFNleRglzIwNlRzLJhNfgDV 644bUU5lxa6JWDbbBd63lPCY9e+SD7V2PrAOhA/q75C9HY0eW+5Y1Hew9JQxXNHPrN62 uP2Q== X-Gm-Message-State: AD7BkJJUKEUK+98Iu3e7+oyF5dTs5Qi9vnyFuqD2so6LmHDKFLKRbheLhkXpKktG7M7QNxgBAsQm7q89VGMW4A== X-Received: by 10.107.137.101 with SMTP id l98mr1814697iod.31.1459611408100; Sat, 02 Apr 2016 08:36:48 -0700 (PDT) In-Reply-To: <87bn5sqcac.fsf@elektro.pacujo.net> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:106291 On Sun, Apr 3, 2016 at 2:07 AM, Marko Rauhamaa wrote: > Chris Angelico : > >> 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=C3=A4tty(): > 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 =3D input("Object name: ") length =3D int(input("Length: ")) width =3D int(input("Width: ")) height =3D int(input("Height: ")) volume =3D 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.) =D0=BD=D0=B0=D0=B7=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5 =3D input("=D0=9D=D0=B0=D0= =B7=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5 =D0=BE=D0=B1=D1=8A=D0=B5=D0=BA=D1=82=D0= =B0: ") =D0=B4=D0=BB=D0=B8=D0=BD=D0=B0 =3D int(input("=D0=94=D0=BB=D0=B8=D0=BD=D0= =B0: ")) =D1=88=D0=B8=D1=80=D0=B8=D0=BD=D0=B0 =3D int(input("=D0=A8=D0=B8=D1=80=D0= =B8=D0=BD=D0=B0: ")) =D0=B2=D1=8B=D1=81=D0=BE=D1=82=D0=B0 =3D int(input("=D0=92=D1=8B=D1=81=D0= =BE=D1=82=D0=B0: ")) =D0=BE=D0=B1=D1=8A=D0=B5=D0=BC =3D =D0=B4=D0=BB=D0=B8=D0=BD=D0=B0 * =D1=88= =D0=B8=D1=80=D0=B8=D0=BD=D0=B0 * =D0=B2=D1=8B=D1=81=D0=BE=D1=82=D0=B0 print("=D0=9E=D0=B1=D1=8A=D0=B5=D0=BC %s =D1=80=D0=B0=D0=B2=D0=BD=D0=BE %d"= % (=D0=BD=D0=B0=D0=B7=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5, =D0=BE=D0=B1=D1=8A=D0= =B5=D0=BC)) 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 =3D input("=D0=9D=D0=B0=D0=B7=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5 =D0=BE= =D0=B1=D1=8A=D0=B5=D0=BA=D1=82=D0=B0: ") dlina =3D int(input("=D0=94=D0=BB=D0=B8=D0=BD=D0=B0: ")) shirina =3D int(input("=D0=A8=D0=B8=D1=80=D0=B8=D0=BD=D0=B0: ")) vysota =3D int(input("=D0=92=D1=8B=D1=81=D0=BE=D1=82=D0=B0: ")) obyem =3D dlina * shirina * vysota print("=D0=9E=D0=B1=D1=8A=D0=B5=D0=BC %s =D1=80=D0=B0=D0=B2=D0=BD=D0=BE %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