"Structure and Interpretation of Computer Programs" in Python?
Ronald Legere
legere at ll.mit.edu
Tue Jun 17 11:38:14 EDT 2003
If anyone else out there is trying this, I wanted to point out one
other potential 'gotcha'. Much of the SICP code in chapter 3 uses set! in
closures. (For example, Exercise 3.11)
However, this won't work in python, because of the way nested
scopes works---you can't rebind names in enclosing scopes.
(But try it and see. ) The 'work around' is to either just use classes
(translate any
scheme procedures that return dispatch functions into classes) or you can
use
containers as described in PEP 227:
http://www.python.org/peps/pep-0227.html
Cheers,
Ron
More information about the Python-list
mailing list