Python's architecture

Martin von Loewis loewis at informatik.hu-berlin.de
Mon Sep 17 04:09:34 EDT 2001


jonas.b at home.se (Jonas Bengtsson) writes:

> Thanks for you answer!
> Now I finally got a source with an explanation of the architecture of
> Python: http://wiki.cs.uiuc.edu/cs427/PYTHON

Well-done research. It seems that this might be well the best write-up
in the style that you seem to be asking for.

If you go through the text and find all the errors, that might be just
about the right amount of work. If you have any specific questions,
like

<question> 
Is it really true that "Python developers would say that the code
evaluator is highly optimized and optimizing across multiple
instructions (...) wouldn't result in that much of a performance gain."  
</question>

don't hesitate to ask. [On this specific question, I'd personally
answer "no"; I think many Python developers would guess that byte-code
level optimization could achieve good results. The elimination of
SET_LINENO is just one example.]

> About reading the source code they state: "Constructing an
> architectural picture from only source code is very tedious work"

Indeed, and this shows the true value of the work of Jim Jackson and
Kar-Han Tan. In another article, you write

> I believe that there has to be some kind of documentation.  ... If
> not, how do the developers get any overview of the interpretator?

There is certainly documentation of the API, and comments throughout
the source code. I'm quite certain that most developers got their
overview without any introductory material into "the Python
architecture". Instead, they got the overview from inspecting the
source code, and matching that with their textbook knowledge, and by
asking specific questions in this group.

Also, many contributors can contribute without having a "detailed
overview" of the full system: To make the zlib module thread-safe, you
don't have to know how the recursive-descend-parser works.

So Python's "architecture", beyond what the dragon book describes, is
rather a collection of "micro-architectures". As the authors found,
there is one for the compiler technology, one for the memory
management, one for the polymorphism. There is also one for
multi-threading.

I think you are quite lucky to have found this reference. To get
specific answers in this group, you need to ask specific questions.
The answer to the question "What architecture overview documents do
the Python developers regularly use?" is probably "None".

Regards,
Martin



More information about the Python-list mailing list