[Types-sig] What is the Essence of Python?
Golden, Howard
GoldenH@littoncorp.com
Thu, 16 Dec 1999 10:54:17 -0800
Edward Welbourne wrote:
> So ... what is the essence of Python ? Eddy's answer:
>
> A bunch of protocols for manipulating namespaces and functions.
>
> An object is a namespace if getattr knows how to ask it for
> attributes.
> Anything you want to do with a namespace, you do by:
> * finding the protocol that describes what you wanted to do
> * looking up the attributes the protocol specifies
> * calling the function (it usually is a function) you just got back,
> with the arguments the protocol specifies, and
> * trusting that this has either:
> - achieved the effect you had in mind, or
> - raised an exception (probably stipulated by the protocol)
>
> There are a few handy built-in types and functions which suffice to
> boot-strap the protocols python defines, and to let you do
> `most' of the
> things you will ever want to do. These suffice for implementation of
> everything else you might want to do. The base protocols are
> specified
> in terms of various names, typically beginning and ending `__'.
This is the _mechanism_ of Python, but is it the _essence_? It's just like
my talk yesterday with my 10 year-old son about the essence of the movie
"Field of Dreams." He said it was about a man building a baseball field in
an Iowa cornfield. I said it was about a man coming to terms with the
conflict with his dead father. My son is very literal in his thinking, so I
understand his analysis. I was trying to encourage him to think below the
surface.
Your answer about Python, and its appeal to you reminds me of how I felt
about Forth, when I first learned it around 1980. Again, you have a very
simple mechanism which is easily extensible to do whatever you want. It is
interactive, too. I suspect that many people are still using Forth, but you
seldom hear about it any more. Probably many of those using Forth have
added all sorts of object-oriented, generic programming, parametric
polymorphism extensions. My question is: Is that still Forth? I think you
could argue either side, but the important point is that it wouldn't _look_
like 1980's Forth.
"What is Python?" is really Guido's decision. (If I agree, I'll use it, and
if not, I'll vote with my feet.) But I am arguing that it is more than just
a clear syntax wrapped around a flexible namespace.
- Howard