how to get the ordinal number in list

Rustom Mody rustompmody at gmail.com
Mon Aug 11 01:23:18 EDT 2014


On Monday, August 11, 2014 12:33:59 AM UTC+5:30, Chris Angelico wrote:
> On Mon, Aug 11, 2014 at 4:26 AM, Rustom Mody wrote:
> > Its when we have variables that are assigned in multiple places that
> > we start seeing mathematical abominations like
> > x = x+1

> That's an abomination to you because it breaks your mathematical
> model. It's fine to a computer, which has a sense of time.

It does?!?!
Completely missed the news flash

Last I knew they were as dumb as a rock -- maybe a GHz rock

A C programmer asked to swap variables x and y, typically writes something like

t = x; x = y; y = t;

Fine, since C cant do better.
But then he assumes that that much sequentialization is inherent to the problem...
Until he sees the python:

x,y = y,x

The same applies generally to all programmers brought up on imperative style.

Yeah there are problems that need to address time -- OSes, network
protocols, reactive systems like window managers etc

But the vast majority of problems that a programmer is likely to solve dont need time.

These are of the form: Given this situation, this is the desired outcome.

Nothing wrong with giving a sequential solution to a not inherently sequential problem.

What is wrong is then thinking that all *problems* are sequential rather than
seeing that some over-specific sequential *solutions* to non-sequential problems are ok.

A mindset exemplified by your hilarious statement: "computers have a sense of time"



More information about the Python-list mailing list