English-like Python

Chris Rebert clp2 at rebertia.com
Fri Jan 16 00:42:17 EST 2009


On Thu, Jan 15, 2009 at 5:02 PM, The Music Guy <musicguy 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? 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")
> 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

Does the name "AppleScript" mean anything to you? ;-)

Cheers,
Chris

-- 
Follow the path of the Iguana...
http://rebertia.com



More information about the Python-list mailing list