Arithmetic sequences in Python

Alex Martelli aleax at mail.comcast.net
Mon Jan 23 02:05:14 CET 2006


Christoph Zwerschke <cito at online.de> wrote:
   ...
> These are valid points, but they lead me to the opposite conclusion: Why
> not let {a,b,c} stand for set([a,b,c])? That would be very intuitive 

As syntax sugar goes, that would be on a par with the current "dict
display" notation, at least.

> (This has been probably discussed already. One problem I'm already 
> seeing is that {} would be ambiguous.)

Yep, using {} for both sets and dicts wouldn't be a good idea.  I
suspect most core Python developers think of dicts as more fundamental
than sets, so... (I may disagree, but I just don't care enough about
such syntax sugar to consider even starting a debate about it on
python-dev, particularly knowing it would fail anyway).

> Anyway, I think the fact that the notation for a set is clumsy is no 
> good reason to make the notation for a list clumsy as well.

I don't agree that <typename>(<arguments>) is a clumsy notation, in
general; rather, I consider "clumsy" much of the syntax sugar that is
traditional in Python.  For example, making a shallow copy of a list L
with L[:] is what strikes me as clumsy -- list(L) is SO much better.
And I vastly prefer dict(a=1,b=2) over the clumsy {'a':1, 'b':2}.

I suspect I'm unusual in that being deeply familiar with some notation
and perfectly used to it does NOT necessarily make me LIKE that
notation, nor does it make me any less disposed to critical reappraisal
of it -- the brains of most people do appear to equate habit with
appreciation.  In the light of my continuous and unceasing critical
reappraisal of Python's syntax choices, I am quite convinced that many
of them are really brilliant -- with the "display forms" of some
built-in types being one area where I find an unusually high density of
non-brilliance, AKA clumsiness.  But, that's just me.


Alex



More information about the Python-list mailing list