Dijkstra on Python

nnes pruebauno at latinmail.com
Wed Aug 14 13:19:53 CEST 2002


"James J. Besemer" <jb at cascade-sys.com> wrote in message news:<mailman.1029211160.24826.python-list at python.org>...
> Al Vining [and many others] write:
> 
> > "There should be one -- and preferably only one
> > -- obvious way to do it."
> 
> 
> However, Python itself breaks its own rules at the low level; e.g. with
> 
>     for
>     while
>     map, et al.
>     list comprehension
> 
> ... Python offers at least 4 redundant ways to iterate over a collection.
> 
or lamda which seems to me like a special case of def. Or print which
is a special case of write() on the standard output. etc.

And the BDFL regrets it (specially read pages 3-5):

http://www.python.org/doc/essays/ppt/regrets/PythonRegrets.pdf

The problem is since Python is an evolving language it may take some
time until the BDFL (by analysing python code/patterns) finds the
preferable and obvious way to do it. To parafrase: The "preferable
only one way" may not be obvious at first unless you're Dutch, and
even then it is tricky :-). In the meantime we are experimenting with
different alternatives.

I can only hope that Python goes with the "less is more" aproach and
starts deprecating some of this stuff, instead of just adding new one,
so that newcomers will use "preferable only one way", making it easier
to read their programms.

A good example of this last is xreadlines which will be deprecated in
2.3 and will be replaced by: for line in file. This was more of an
performance issue in the old implementation than anything else. But a
lot of my code used it, because it was faster under 2.1. So now I will
actually having 2 ways to do the same depending on the Python version:
the 2.1 way and the more cleaned up way.

Hopefully the language will converge to cover 90% of the common tasks
at hand using obvious syntax, and these being the speed optimized ones
to encourage its usage.

I still prefer growing pains to no growth

Nestor



More information about the Python-list mailing list