Message86402
In (for example) Python 2.6:
>>> float('1e500')
inf
>>> complex('1e500')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: float() out of range: 1e500
I'd say that one of these is a bug, but I'm not sure which one.
Ideally, float('1e500') would raise OverflowError (not ValueError). But
it's quite likely that there are people who depend on the current
behaviour, and the current behaviour also agrees with what happens for
float literals:
>>> 1e500
inf
For 2.7 and 3.1, I propose fixing the complex constructor so that
complex('1e500') produces (inf+0j). For 2.6 and 3.0, I propose leaving
the current behaviour as it is. |
|
Date |
User |
Action |
Args |
2009-04-24 12:26:21 | mark.dickinson | set | recipients:
+ mark.dickinson |
2009-04-24 12:26:21 | mark.dickinson | set | messageid: <1240575981.53.0.816378591256.issue5829@psf.upfronthosting.co.za> |
2009-04-24 12:26:20 | mark.dickinson | link | issue5829 messages |
2009-04-24 12:26:19 | mark.dickinson | create | |
|