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 <rep...@bugs.python.org> <http://bugs.python.org/issue26506> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com