English-like Python

Kay Schluehr kay.schluehr at gmx.net
Sat Jan 17 05:28:04 EST 2009


On 16 Jan., 02:02, The Music Guy <music... at alphaios.net> wrote:
> Just out of curiousity, have there been any attempts to make a version
> of Python that looks like actual English text?

No, but I've once written a Python dialect that uses German text. Just
look at how amazing this result is !!! But be warned it requires
knowledge of the German language.

http://www.fiber-space.de/EasyExtend/doc/teuton/teuton.htm


> I mean, so much of Python
> is already based on the English language that it seems like the next
> natural step would be to make a programming language which is actually a
> spoken one.

As you know Python 3.0 has full unicode support. Python 4.0 will be
surely written in Mandarin or Hindi.

> For example, the following code...
>
> >>> import os
>
> >>> def list_files(dirname):
> >>>     for p in os.listdir(dirname):
> >>>         print p
>
> >>> list_files("some_dir")
>
> foo
> bar
> etc
>
> ...might be translated as...
>
> >>> Import the operating system module.
>
> >>> Define a new function as "list files" which accepts
>
>     "a path" and does the following:
>         For every item in the list returned by the operating system's
>         directory listing of the given path, do the following:
>              Print the item.
>
> >>> List files from "some_dir".
>
> foo
> bar
> etc
>
> Obviously, creating a parser capable of handling such "code" would
> require a very good understanding not only of the English language but
> also of how ideas expressed in spoken languages are represented in terms
> that a computer can understand.

Yep. Resolving ambiguities in natural languages is actually an open
research topic. Moving from Python to a language that is more context
dependent than Larry Wall ever dreamed about and launch an interpreter
on the Enterprise is actually a worthwhile project for future
generations.

Kay



More information about the Python-list mailing list