English-like Python

The Music Guy musicguy at alphaios.net
Fri Jan 16 02:02:55 CET 2009

Just out of curiousity, have there been any attempts to make a version
of Python that looks like actual English text? 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.

For example, the following code...

>>> import os
>>> def list_files(dirname):
>>>     for p in os.listdir(dirname):
>>>         print p
>>> list_files("some_dir")

...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".

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.

A language like this would, of course, blow a lot of staple coding
coding concepts like "variables," "objects," etc. right out of the
water. I think, however, that it could be done, and wouldn't necessarily
have to be any slower than any other scripting language as any text/code
could be cached as bytecode, just like Python.

I know it's sort of silly but I think something like this would be very
interesting, maybe even useful. ^_^

http://Alphaios.net - Tracked Module Music, Blog, and Links.

More information about the Python-list mailing list