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
Sun Apr 6 22:32:29 EDT 2014


On Monday, April 7, 2014 12:16:54 AM UTC+5:30, Chris Angelico wrote:

> On Mon, Apr 7, 2014 at 4:13 AM, Rustom Mody wrote:
> >> Using Python at the design stage would be what Steven's talking about
> >> - actually using it to build the theory of programming. I have about
> >> as much experience in the area as he has, so we can't speak to the
> >> lack of examples, but that's the sort of example it would take.

> > !Parse Error! What are you saying -- I don get :-)

> What I'm saying is that I - and, if my reading is correct, similarly
> with Steven - am looking for is a prominent example of someone using
> Python as the very basis for a discussion on the future of computer
> science *as a field*. So, not "here's what can be done with Python",
> and not "here's something about hydraulics, with some Python code
> showing how my theory adds up". If you're developing a cryptography
> algorithm, it might well be convenient to support it with Python code
> (although I mostly see reference implementations in C), but that's
> still using Python as a tool, rather than as a language for
> fundamental development of comp sci theories.

Nice example

10 years ago Nicholas Carr wrote an article: "Does IT matter?"
http://hbr.org/2003/05/it-doesnt-matter/ar/1

| Twenty years ago, most executives looked down on computers as
| proletarian tools—glorified typewriters and calculators—best relegated
| to low level employees like secretaries, analysts, and technicians. It
| was the rare executive who would let his fingers touch a keyboard,
| much less incorporate information technology into his strategic
| thinking. Today, that has changed completely. Chief executives now
| routinely talk about the strategic value of information technology...
|  
| Behind the change in thinking lies a simple assumption: that as IT’s
| potency and ubiquity have increased, so too has its strategic
| value. It’s a reasonable assumption, even an intuitive one. But it’s
| mistaken. What makes a resource truly strategic—what gives it the
| capacity to be the basis for a sustained competitive advantage—is not
| ubiquity but scarcity. You only gain an edge over rivals by having or
| doing something that they can’t have or do. By now, the core functions
| of IT—data storage, data processing, and data transport—have become
| available and affordable to all.1 Their very power and presence have
| begun to transform them from potentially strategic resources into
| commodity factors of production. They are becoming costs of doing
| business that must be paid by all but provide distinction to none.

Now replace IT by CS.

CS matters because it has stopped being visible -- entered the woodword.
This is the underlying principle of python replacing scheme for programming
at MIT. Its not that python is a better language. Its rather that 
doing the job and getting out of the way is more crucial today than 1980.
http://cemerick.com/2009/03/24/why-mit-now-uses-python-instead-of-scheme-for-its-undergraduate-cs-program/

So cryptographic algos need (typically)
1. An algorithmic language
2. Fast implementations
Python only provides 1, C provides both.So C is more useful (ignoring the marginal effects of inertia)

> > Is the diff between cvs/svn and git "just one vcs or another"?

> The theory of version control, or source control, or whatever you want
> to call it, can be found in some of the docs for those systems (git
> goes into some depth about the Directed Acyclic Graph that underpins
> everything), but that theory isn't what makes git or cvs/svn useful.

> The theory behind my MUD client "Gypsum" is that it should be built
> the way a server is, including that it should not need to be restarted
> even when there's new code to be loaded in; but that's not what makes
> Gypsum useful.

> The theory behind an ergonomic keyboard is that it should hurt your
> hands less than a classic keyboard does, but that's not what makes it
> useful. Actually, in that instance, it might be what makes it
> useless...

These examples are very different:
1. MUD I dont know
2. Ergonomic keyboard is a good example.
   For a ergonomic keyboard to be useful it has to satisfy the precondition
   "Not more than a δ neighborhood away from QWERTY"
3. Git: We differ on whats the underlying theory. For me crucial is
   a. Peer-to-peer replacing client-server -- this gives the D in DVCS
   b. Branching as central to software (more generally any material) development



More information about the Python-list mailing list