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?
Software Engineering Stack Exchange is a question and answer site for professionals, academics, and students working within the systems development life cycle. It only takes a minute to sign up.
Sign up to join this communityI 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?
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.