how to get the ordinal number in list
Roy Smith
roy at panix.com
Sun Aug 10 18:01:08 EDT 2014
In article <mailman.12827.1407702752.18130.python-list at python.org>,
Mark Lawrence <breamoreboy at yahoo.co.uk> wrote:
> On 10/08/2014 19:26, Rustom Mody wrote:
> >
> > Its when we have variables that are assigned in multiple places that
> > we start seeing mathematical abominations like
> > x = x+1
> >
>
> I'm not bothered about it being a mathematical or any other type of
> abomination. It works, practically beats purity, so if it ain't broke,
> please don't fix it, for some definition of fix.
I'm with Mark. This isn't math, it's programming. Sure, the
intersection of the two is non-null, but they are different things.
I'll often do things like:
for line in input:
line = line.strip()
# do more stuff
Sure, I could invent some other variable name to avoid re-using the same
name, but does:
for line in input:
stripped_line = line.strip()
# do more stuff
really make this any easier to read or understand? I think not.
More information about the Python-list
mailing list