[issue26506] hex() documentation: mention "%x" % int

Serhiy Storchaka report at bugs.python.org
Fri Mar 11 03:51:36 EST 2016


Serhiy Storchaka added the comment:

I agree with you and always prefer formatting strings.

Your example shows that at least an alternative to str.zfill() should be mentioned in the educational purposes.

With C-style formatting your example can be written more laconically:

    return "%0*x" % (length, ...)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26506>
_______________________________________


More information about the Python-bugs-list mailing list