Alexander Belopolsky belopol...@users.sourceforge.net added the comment:
The original bug report is invalid and the documentation issue is a duplicate
of #8913.
--
nosy: +belopolsky
resolution: - duplicate
superseder: - Document that datetime.__format__ is datetime.strftime
Changes by Alexander Belopolsky belopol...@users.sourceforge.net:
--
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7789
___
New submission from JordanS jps...@mun.ca:
format() cannot handle datetime.DateTime objects, returns the format_spec
instead, without applying formatting to it, perhaps default behaviour in case
of unknown type. Different modifications, ie: using str.format() syntax produce
same behaviour.
Changes by Brian Curtin cur...@acm.org:
--
components: +Library (Lib) -2to3 (2.x to 3.0 conversion tool)
priority: - normal
stage: - test needed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7789
JordanS jps...@mun.ca added the comment:
sorry, first time posting anything like this:
versions:
Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] on
win32
--
___
Python tracker rep...@bugs.python.org
Eric Smith e...@trueblade.com added the comment:
datetime.datetime passes its format string to strftime:
import datetime
x = datetime.datetime(2001, 1, 2, 3, 4)
x.strftime('%Y-%m-%d')
'2001-01-02'
'{0:%Y-%m-%d}'.format(x)
'2001-01-02'
I'll check to make sure this is documented.
--
R. David Murray rdmur...@bitdance.com added the comment:
If it is, it isn't any place obvious. I thought I remembered something about
using strftime strings in format, but when I looked in the docs for datetime
and the section on the format mini language I couldn't find it, so I ended up
Eric Smith e...@trueblade.com added the comment:
I don't think this is documented (that I can find, at least), so I'll assign it
to Georg.
I think the correct thing to do is something like this, in the datetime, date,
and time object descriptions:
date.__format__(fmt)
For a date d,
Eric Smith e...@trueblade.com added the comment:
The documentation for this belongs in the mini-language specification, since
that just address built-in types. Each type can define its own format
specification language.
So I think adding documentation of __format__ to each non-builtin type
Eric Smith e...@trueblade.com added the comment:
Eric Smith wrote:
The documentation for this belongs in the mini-language specification, ...
Oops. does NOT belong in the mini-language specification.
--
___
Python tracker rep...@bugs.python.org
Changes by Eric Smith e...@trueblade.com:
--
assignee: eric.smith - georg.brandl
nosy: +georg.brandl
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7789
___
11 matches
Mail list logo