[issue7789] Issue using datetime with format()

2010-10-04 Thread Alexander Belopolsky
Changes by Alexander Belopolsky : -- status: open -> closed ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http

[issue7789] Issue using datetime with format()

2010-10-04 Thread Alexander Belopolsky
Alexander Belopolsky 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 ___

[issue7789] Issue using datetime with format()

2010-01-26 Thread Eric Smith
Changes by Eric Smith : -- assignee: eric.smith -> georg.brandl nosy: +georg.brandl ___ Python tracker ___ ___ Python-bugs-list mailing

[issue7789] Issue using datetime with format()

2010-01-26 Thread Eric Smith
Eric Smith 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 __

[issue7789] Issue using datetime with format()

2010-01-26 Thread Eric Smith
Eric Smith 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 that implements __fo

[issue7789] Issue using datetime with format()

2010-01-26 Thread Eric Smith
Eric Smith 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, format(d, fmt) is equiva

[issue7789] Issue using datetime with format()

2010-01-26 Thread R. David Murray
R. David Murray 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 doing '{} ...'.format(x.s

[issue7789] Issue using datetime with format()

2010-01-26 Thread Eric Smith
Eric Smith 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. -- assign

[issue7789] Issue using datetime with format()

2010-01-26 Thread JordanS
JordanS 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

[issue7789] Issue using datetime with format()

2010-01-26 Thread Brian Curtin
Changes by Brian Curtin : -- components: +Library (Lib) -2to3 (2.x to 3.0 conversion tool) priority: -> normal stage: -> test needed ___ Python tracker ___ _

[issue7789] Issue using datetime with format()

2010-01-26 Thread JordanS
New submission from JordanS : 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. Sample code: