Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

Rustom Mody rustompmody at gmail.com
Thu Mar 27 22:46:07 EDT 2014


On Friday, March 28, 2014 3:44:09 AM UTC+5:30, Mark H. Harris wrote:
> On 3/27/14 4:42 PM, Chris Angelico wrote:
> > And this is the bit where, I think, we disagree. I think that
> > programming is for programmers, in the same way that music is for
> > musicians and the giving of legal advice is for lawyers. Yes, there
> > are armchair lawyers, and plenty of people can pick up a hymn book and
> > sing;

As for programming its just too much in-our-face (to most of us
reading this at least) to discuss it from the pov of 'the* layman'
for the same reason that if I try to show you something and stick it
½ inch from your nose, you wont be able to see it.

Your other examples fire quite differently than you (perhaps) realize

As for laws, I am reminded of the Tao te Ching:

Therefore the Master says:
I let go of the law, and people become honest.
I let go of economics, and people become prosperous.
I let go of religion, and people become serene.
I let go of all desire for the common good, and the good becomes common as grass. 
http://acc6.its.brooklyn.cuny.edu/~phalsall/texts/taote-v3.html#57

As for music I find (as Mark does) that technology allows for a 
10-fold leap in learning:
When I learnt the piano, 10 years to perform anything reasonably
and 10 months to make head-or-tail of staff notation were fair estimates.

Today, spend 10 days browsing your favourite genre at
http://musescore.com/ with a little guidance and staff notation stops being difficult.
A couple of weeks more and one and start entering music into the computer (or phone)

> ------------------------------------
> > but laws and operas aren't designed with them in mind. Why
> > should programming languages be designed for the people who don't want
> > to learn them?

> Actually we agree quite a bit on this--I agree with everything above the 
> line----- and some of the sentiment with everything below the line.

> Your question has a somewhat false premise. They *really do* want to 
> learn them, and they are frustrated with the time and attention it 
> takes. The argument is also from analogy, which in this case is almost 
> similar but not quite.

Well if you see http://cultureandempire.com/cande.html there is this
interesting insight:

> Moore’s Law isn’t a mythical beast that magically materialized in 1965
> and threatens to unpredictably vanish at any moment. In fact, it’s
> part of a broader ancient mechanism that has no intention of
> stopping. This mechanism, which I call cost gravity, pulls down the
> price of technology by about half every two years.

Add to that the fact that cost=money ultimately comes from money=effort
eg currencies like http://en.wikipedia.org/wiki/Ithaca_Hours
(maybe even dolour → dollar though thats not the official etymology)
and its clear that there is a ripple effect of technology breaking down
old castles. Pleasant to the* layman, unpleasant to those professionals whose 
fiefdoms are threatened.

> A car's engine usually isn't tuned for 10km/h running; you have to get
> up a bit of speed before it becomes more efficient. Why is it so wrong
> for Python to expect the same? 

Lets (temporarily) invert your example:
100 years ago, cobbled streets and horse-carriages were not meant for 100 kmph
speeds. Today's roads are.
Likewise technology: Like the natural speed of roads has changed, the natural
accessibility of technology has also.
A big part of python's success was that 20 years ago it worked out way more
accessible than C. This peaked around 10 years ago.  Nowadays I am not so sure 
what its direction is...

------------
* And I'll leave it to Steven to cudgel the 'the' <wink>



More information about the Python-list mailing list