Alexander Belopolsky <[EMAIL PROTECTED]> added the comment:

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.

_______________________________________
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue3008>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to