[Edu-sig] Python's keywords and functions convertor into native language for lowering entrance barrier

kirby urner kirby.urner at gmail.com
Wed Jan 30 23:01:58 CET 2013


Hi Murat --

I presume you know that Python 3 source code may use any Unicode strings
for names, including variables, functions, classes and so on.

That leaves 33 keywords in English.

>>> import keyword
>>> keyword.kwlist

You can write a script that simply catalogs synonyms for builtins.

>>> басуу = print
>>> басуу(10)
10

'print' is not a keyword in Python 3 so this assigning of a Kyrgyz name is
possible.

So if you had a script named kyrgyz.py, you could provide many synonyms for
common functions such as dir, input, and even type names such as str, list,
int, dict, float.

However, what dir( ) returns will still contain English much of the time.
The Standard Library is in English.

This compromise solution that keeps the 33 English keywords at a minimum
will help students learn to read more Python written by others.  They won't
need a "special Python" to interpret the code.

The documentation, docstrings, variable, function, class names etc. can all
be in Krgyz even now, with no further modifications.

I work with a programmer in Indonesia who sometimes sends me Python that's
90% Indonesian.

Here's a Wiki page on the topic of Python in non-Latin1-languages:

http://wiki.python.org/moin/Languages

Kirby

Sample source (Kazakh):

 # -*- coding: utf-8 -*- # python 3.0/3.1 сәлем = ['Қайырлы таң',
'Қайырлы күн', 'Қайырлы жаріқ'] менйм_атйм = ['Арүжан', 'Меиржан']
for сәлемx in сәлем:     for менйм_атймx in менйм_атйм:
print(сәлемx + ' ' + менйм_атймx)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/edu-sig/attachments/20130130/fca42552/attachment.html>


More information about the Edu-sig mailing list