[Python-Dev] infinities

tomer filiba tomerfiliba at gmail.com
Sun Nov 26 20:57:08 CET 2006

> Um, you do realize that you're not going to be able to fit sys.maxint
> strings into a list, right?
i can multiply by four, thank you. of course i don't expect anyone to read
a string *that* long.

besides, this *particular example* isn't important, it was just meant to
show why someone might want to use it. why are people being so picky
about the details of an example code?

first of all, a "while True" loop is not limited by sys.maxint, so i see no
reason why i couldn't get the same result by subtracting from infinity.
that may seem blunt, but it's a good way have the same code handle
both cases (limited and unlimited reading).

all i was asking for was a better way to express and handle infinity
(and nan), instead of the poor-man's version of "nan = 2e2222/3e3333".
float.posinf or float.isinf(5.0) seem the right way to me.

for some reference, it seemed the right way to other people too:

the third-party fp module is nice, but it ought to be part of the float type,
or at least part of stdlib.

- - - - - -

if it were up to me, *literals* producing infinity would be a syntax error
(of course i would allow computations to result in infinity).

for the reason why, consider this:
>>> 1e11111 == 2e22222


More information about the Python-Dev mailing list