how to get the ordinal number in list

Chris Angelico rosuav at gmail.com
Sun Aug 10 15:03:59 EDT 2014


On Mon, Aug 11, 2014 at 4:26 AM, Rustom Mody <rustompmody at gmail.com> 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. And it even
can be strictly true. Consider:

>>> x = 2.0**53
>>> x = x + 1
>>> x == x + 1
True

x is clearly not infinity, yet it's equal to itself plus one. If
you're going to try to pretend that maths and computers are exactly
the same, you have a LOT of problems to deal with.

In computing, assignment and reassignment aren't at all problematic,
and neither is printing to the console, so please stop telling people
off for using them.

ChrisA



More information about the Python-list mailing list