[Python-Dev] Translate Python language (original) (raw)

Paul Moore p.f.moore at gmail.com
Wed Nov 11 11:17:33 EST 2015


On 11 November 2015 at 15:13, Christophe Bal <projetmbc at gmail.com> wrote:

Hello.

I'm a french teacher and I would like to use Python with young child but I've a big problem. All the keyword are in english. So I would like to know if there is a way to hack the AST tools such as to use french keywords and then translate a list of french keywords to their english regular version. Where should I start ? My idea is not to build a new language but simply translate words using an hacked version of the AST tools. Hoping to be clear and I do not pollute the message in this list.

Do you really just mean keywords? Most of the English words used in Python (for example "open") aren't actually keywords but are names of functions defined in the builtins and/or standard library. Those are not exposed as distinct objects in the AST, but are simply name lookups.

If you do mean just keywords, then you could probably relatively simply hack the Python interpreter code to use different names for the keywords, and build your own translated copy of Python. I don't know the details, though. But in practice this wouldn't really help your student, as there would still be many English words they would encounter and need to understand (at least in the context of the code they are writing).

My understanding is that most non-English speaking teachers tend to accept that their students simply need to treat the keywords and function names used in typical programming languages (Python included) as things they just have to learn. But I suspect most students are typically older than your young child.

Sorry I can't be more help. Paul



More information about the Python-Dev mailing list