Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I understand that the classical model from the lambda-papers is not valid for Python.

And the closures are not the mathematical model of the implementation of the Python system.

So which model is it?

share|improve this question
If I know the model, I thought that I could find a detailed book (like sicp for lisps), that would describe the process of building a system from scratch. –  alinsoar Dec 7 '12 at 0:30
Related: stackoverflow.com/q/2469824. I removed your second question from the body of your post (How to build a Python system from scratch), because it's unanswerable here. If you want to know how to develop an actual working programming language, you should look into things like parsers, lexers and compilers. –  Robert Harvey Dec 7 '12 at 0:31
Thanks ! The second question was equivalent to the first one! If I know the model, I can find a doc that describes it practically, so that shows how to build the kernel of the system! –  alinsoar Dec 7 '12 at 0:32
Great question!!! :) –  Maxood Dec 7 '12 at 11:18
add comment

1 Answer

up vote 5 down vote accepted

The main difference between Python and models from classical papers on the lambda calculus is that Python is a multi-paradigm language. Most papers which consider the lambda calculus consider a pure functional language, without the complexities involved by adding other paradigms (like OOP or logical programming).

From the question and your comments, I take it that you are interested in the foundations of such multi-paradigm languages. In that case, I can highly suggest Concepts, Techniques, and Models of Computer Programming by Peter van Roy and Seif Haridi. The book is mainly about the Mozart/Oz language, which in itself is a rather academic language. However, the book very clearly demonstrates how to start off with a very small core language and build object-orientation, functional, and logic programming on top of it (and all within the same core language).

As for the actual mathematical model, most programming languages have only an informal or semi-formal specification. Seldom do you find one that has a proper theory like the lambda calculus as its foundation. There are a lot of different mathematical models that have been invented and are more or less applicable. What's interesting is that there is a general distinction into the different approaches to how programming semantics are modeled: semantics can be described denotationally, operationally, or algebraically. If you want to go even deeper, then reading up a little about the Unifying Theories of Programming is a start, albeit a tough one with a steep learning curve.

share|improve this answer
nice answer. thanks. –  alinsoar Dec 7 '12 at 16:04
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.