[Python-3000] Support for PEP 3131

James Y Knight foom at fuhm.net
Tue Jun 5 04:48:26 CEST 2007


On Jun 4, 2007, at 3:43 PM, Josiah Carlson wrote:
> Here is some code borrowed right from the Python standard library.   
> I've
> gone ahead and mangled names in a consistant fashion using the  
> tokenize
> module.  Can you guess what it does?

Nope, it's absolutely inscrutable. And actually, after I found this  
module in the stdlib and read the same excerpt in english, I *still*  
couldn't figure out what it was doing. (it's in multifile.py, btw).  
Of course, the given excerpt doesn't really do anything useful  
(without the rest of the class), which doesn't help things.

Anyhow, if it was in a human language, I'd paste it into an online  
translator.

e.g. from another recent message:
> def итератор_по_токенам_в_строках_файла 
> (имя_файла):
>      файл = open(имя_файла, "rb")
>      for строка in файл:
>          yield строка.split()

pasted verbatim right into google translator results in:

> def iterator_po_tokenam_v_strokah_fayla (filename) : file = open  
> (filename, "rb") for strings in the file : stroka.split yield ()

Not entirely successful -- it's not built to translate code, of  
course. :)

Let's try some of those phrases again:
"итератор по токенам в строках файла" ->  
"standard for token lines in the file". Hm, I liked "iterator" better  
than "standard" there, but okay. so, this is supposed to iterate  
tokens from lines in a file. Okay.
"строка" -> "line".

All right, I think I've got it. In fact, translation is *much*  
*easier* when the code in the other language is spelled with the  
proper characters of that language, instead of some random  
romanization. I'd have extremely little hope of being able to convert  
a romanization of russian into real russian in order to be able to  
translate it into english.

So, all things considered, allowing russian identifiers is a huge  
plus for my ability to read russian code. +1.

James


More information about the Python-3000 mailing list