[Python-ideas] Assignments in list/generator expressions

Laura Creighton lac at openend.se
Mon Apr 11 02:39:36 CEST 2011


In a message of Sun, 10 Apr 2011 20:18:35 EDT, Eugene Toder writes:
<snip>
>This particular feature is not the top on my wish list either. I just
>don't see a good explanation for why it's missing. It's a lesser-known
>feature in Haskell (no mention in Wikipedia! :-), but it is handy at
>times. As mentioned above, people suggest it for Python from time to
>time.
<snip>

The problem, as I see it is that you see it as ``missing''.  You have
some internal model of computer languages and not having it disagrees
with your notion of 'completeness' or 'symmetry' or 'consistency' or
something along those lines.

But the reason I was drawn to python in the first place was that it was
an elegant language, which in practice meant that it didn't have a lot
of cruft I found in other languages.  After all, if I had wanted to use
those other languages, I know where to find them.  And I actually enjoy
using Haskell, on those very rare occasions when I have a problem that
I find suited to the language.  

But turning Python more Haskell-like has no appeal to me.  I need a set
of very concrete use cases of 'I am trying to do this' and either 'I cannot'
or 'I am doing it this way and oh, how slow/ugly/error prone/ it is!'
before I am interested in a proposal.  Change for the sake of completeness
has no value to me.

I may be blessed in that I live in Gothenburg, Sweden, where Chalmers University
is one of the great centres of Haskell-admiration.  So I have many friends
who love the language so much they try to do everything in it.  Debugging a
failing webserver written in Haskell has been painful.  There is real
value in using whitespace and indentation to separate logical ideas, and
jamming everything into a comprehension completely destroys this.  The
aesthetic gain in symmetry comes a very, very, distant second to me in
this race.

Laura




More information about the Python-ideas mailing list