[issue26506] hex() documentation: mention "%x" % int
Serhiy Storchaka
report at bugs.python.org
Thu Mar 10 12:47:35 EST 2016
Serhiy Storchaka added the comment:
> That's why I ran the micro-benchmark and, in fact, I was expecting %-interpolation to be faster exactly because it is less flexible.
Actually %-interpolation is more flexible.
>>> '%x' % 123
'7b'
>>> '%0X' % 123
'7B'
>>> '%#x' % 123
'0x7b'
>>> '%04x' % 123
'007b'
If document alternatives for hex(), we should also document formatting alternatives for bin(), oct(), repr(), ascii(), str(), chr(), str.ljust(), str.rjust(), str.center(), str.zfill().
----------
nosy: +serhiy.storchaka
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26506>
_______________________________________
More information about the Python-bugs-list
mailing list