Message86402
| Author |
mark.dickinson |
| Recipients |
mark.dickinson |
| Date |
2009年04月24日.12:26:19 |
| SpamBayes Score |
3.4527936e-14 |
| Marked as misclassified |
No |
| Message-id |
<1240575981.53.0.816378591256.issue5829@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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. |
|
History
|
|---|
| 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 |
|