Thoughts about Python

Marco Aschwanden PPNTWIMBXFFC at spammotel.com
Wed Feb 25 10:58:14 CET 2004


> > *** Problem: tuples are not necessary
> 
> Frankly, there is very little in any programming language that is
> necessary. Back when I brushed up against computability theory,
> I found that all programs can be written in a language with one operation:
> a combination of subtract and conditional branch. That's hardly
> practical, though. The question is whether a feature serves a useful
> purpose.

I once read an interesting article that a programming language can be
reduced to 4 instructions: (1) input (2) output (3) if-then (4) goto.
All other commands / functions are built upon those 4 "basic ideas".

I would say: Python struggles for a maximum functionalty by preserving
optimal "simplicity". And it does a good job at that! That's why I
like it so much.

I am not a reductionist. And I am not asking to create a reduced
Python. I had just the feeling that to learn about all specialities of
tuples is not worth the hassle... obviously I was wrong and you bring
some more aspects in favour tuples further down below:

> Tuples serve two distinct purposes. One is as a cheap version
> of a C struct: that is, a data structure in which each element
> serves a conceptually different purpose.
> 
> The other is as a structure that is immutable so it can be used
> as a key in a dict.
> 
> One thing to understand about this is that immutability is key:
> dicts depend on having a hash key that is somehow derived
> from the content of the object, and if the content of a key
> changes that key will probably simply be unlocatable: it will be
> filed in the dict under the old rather than the new hash code.

Cheers,
Marco



More information about the Python-list mailing list