Is Python really "Lisp without parentheses"? So would it be easy to *implement* a lot of Python in Scheme/Lisp?

Devin Jeanpierre jeanpierreda at gmail.com
Fri Jan 3 13:32:48 EST 2014


On Fri, Jan 3, 2014 at 9:26 AM, Chris Seberino <cseberino at gmail.com> wrote:
> On Friday, January 3, 2014 11:10:07 AM UTC-6, Devin Jeanpierre wrote:
>> A lecturer of mine back in university did this (implemented a subset
>> of Python in Racket). My understanding is that this is primarily
>> interesting to show that Racket is not as crazily different as it
>> looks from the syntax.
>
> Is that on the web anywhere?  That would be very interesting to look at.  I'm sure others would find it useful too.

As far as I know, no. There was an early version of it that was part
of a course, but as I understand it he did something much more
thorough later on. Even that course content seems to be offline and
not very available by archive.org; the relevant bits aren't archived:
https://web.archive.org/web/20111119221012/http://www.cs.toronto.edu/~gfb/csc324/2010F/content.shtml

Feel free to dig around and try to find something, but as I recall the
assignment on that page was to write some very minor interpreter
actions with a list generated from the AST of a python source file.
His later work was translating Python to Racket, with macros to
implement various Python operations. That wasn't an assignment or
course content, it was stuff he'd show to students during office hours
and such.


I believe the end goal was to turn it into a real tool for teaching
programming. The idea there was that Python is 90% irrelevant to
teaching students how to program, and the full generality of Python
makes it harder for students to learn due to weird behaviours or
unreasonable complexity. If you decide to only implement the 10% of
Python that you care to teach, then it's much easier to implement (in
fact, without that, the goal isn't even achievable for one person),
plus it serves your goals potentially better than Python does.

Regardless of if it's a particularly good idea, this is what Python
must look like if you try to elegantly directly translate it to Scheme
(or any lisp), just because the semantics will be so different once
you get out of the basics and the trivial things. If the translation
is to be clean, the input language can't actually be Python. If the
input language is Python, the output will be a horrible mess that
isn't useful for the student, and also it will take a lot of work
until it is even correct. Scheme is far simpler and smaller than
Python is.

-- Devin



More information about the Python-list mailing list