Why must implementing Python be hard unlike Scheme?

Paul Rubin http
Fri Feb 22 19:45:36 EST 2008


"seberino at spawar.navy.mil" <seberino at spawar.navy.mil> writes:
> Certainly, "(almost) everything is an object" is a good start.  Are
> there any other axiom like statements one can hang their hat on when
> trying to wrap their brain around Python's architecture?

As John Nagle put it, the data store is a tree of hashes.  Python
objects are closures whose method calls look up internal functions
from a hash table.  Python iterators are closures that call a function
repeatedly, yielding values.  Python generators are closures that
package a (continuation, value) pair at each yield statement, with an
iterator that gives the value at each iteration to the caller, and
calls the continuation.  This doesn't use the full power of Scheme
continuations, but is the main Python feature that isn't
straightforward to code in an imperative language with no coroutines.
Aside from that, the ground types are a little different from Scheme's
(strings are immutable, there are no ratios, lists are implemented as
self-extending vectors, there is a dictionary type that is at the
center of practically everything) but it is all pretty
straightforward.  




More information about the Python-list mailing list