Message67537
| Author | belopolsky |
|---|---|
| Recipients | belopolsky, pitrou, rhettinger |
| Date | 2008-05-30.17:35:23 |
| SpamBayes Score | 9.084742e-05 |
| Marked as misclassified | No |
| Message-id | <1212168931.31.0.271969910347.issue3008@psf.upfronthosting.co.za> |
| In-reply-to |
| Content | |
|---|---|
While writing my previous comments I did not realize that '%x' % accepts
floats:
>>> "%x" % 3.1415
'3'
Float support has been even improved somewhat since 2.5:
Python 2.5 (r25:51908, Nov 24 2006, 11:03:50)
>>> '%x' % 1e10
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: int argument required
The new stile formatting, however does not allow floats with either :x
or :b formats:
>>> "{0:x}".format(1.)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: Unknown conversion type x
>>> "{0:b}".format(1.)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: Unknown conversion type b
I don't think anything needs to be done about it given that % formatting
is being deprecated while new style format is doing the right thing IMO. |
|
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2008-05-30 17:35:32 | belopolsky | set | spambayes_score: 9.08474e-05 -> 9.084742e-05 recipients: + belopolsky, rhettinger, pitrou |
| 2008-05-30 17:35:31 | belopolsky | set | spambayes_score: 9.08474e-05 -> 9.08474e-05 messageid: <1212168931.31.0.271969910347.issue3008@psf.upfronthosting.co.za> |
| 2008-05-30 17:35:30 | belopolsky | link | issue3008 messages |
| 2008-05-30 17:35:26 | belopolsky | create | |