[docs] [issue8913] Document that datetime.__format__ is datetime.strftime

Alexander Belopolsky report at bugs.python.org
Sun Jun 6 07:56:13 CEST 2010


Alexander Belopolsky <belopolsky at users.sourceforge.net> added the comment:

I wonder if this is subject to change.  I find it odd that

>>> "{:g}".format(1e3)
'1000'

but one has to use % in

>>> "{:%Y}".format(datetime.now())
'2010'

It is also different from PEP 3101 recommendation:
"""
    An example is the 'datetime' class,
    whose format specifiers might look something like the
    arguments to the strftime() function:

        "Today is: {0:a b d H:M:S Y}".format(datetime.now())
"""
The above, however, should probably be

"Today is: {0:a} {0:b} {0:d} {0:H}:{0:M}:{0:S} {0:Y}".format(datetime.now())

----------
nosy: +belopolsky

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


More information about the docs mailing list