Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(587)

#19475: Add timespec optional flag to datetime isoformat() to choose the precision

Can't Edit
Can't Publish+Mail
Start Review
Created:
2 years, 2 months ago by skip.montanaro
Modified:
1 year, 7 months ago
Reviewers:
victor.stinner, berker.peksag, alessandro.cucci, ghost.adh, vadmium+py, alexander.belopolsky
CC:
lemburg, gvanrossum, tim.peters, terry.reedy, sasha, haypo, ezio.melotti, cvrebert, devnull_psf.upfronthosting.co.za, berkerpeksag, Martin Panter, matrixise, jerry.r.elmore_gmail.com, acucci
Visibility:
Public.

Patch Set 1 #

Total comments: 10

Patch Set 2 #

Total comments: 19

Patch Set 3 #

Total comments: 17

Patch Set 4 #

Total comments: 13

Patch Set 5 #

Total comments: 3

Patch Set 6 #

Total comments: 3

Patch Set 7 #

Patch Set 8 #

Total comments: 4

Patch Set 9 #

Patch Set 10 #

Total comments: 12

Patch Set 11 #

Total comments: 19

Patch Set 12 #

Total comments: 8

Patch Set 13 #

Patch Set 14 #

Total comments: 11

Patch Set 15 #

Patch Set 16 #

Total comments: 10

Patch Set 17 #

Unified diffs Side-by-side diffs Delta from patch set Stats Patch
Doc/library/datetime.rst View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 3 chunks +62 lines, -2 lines 0 comments Download
Lib/datetime.py View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 3 chunks +36 lines, -15 lines 0 comments Download
Lib/test/datetimetester.py View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 2 chunks +42 lines, -6 lines 0 comments Download
Modules/_datetimemodule.c View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 4 chunks +97 lines, -30 lines 0 comments Download

Messages

Total messages: 33
haypo
https://bugs.python.org/review/19475/diff/15275/Lib/datetime.py File Lib/datetime.py (right): https://bugs.python.org/review/19475/diff/15275/Lib/datetime.py#newcode1577 Lib/datetime.py:1577: ‘auto’: Default behaviour. The default behaviour must be explained: ...
2 years, 2 months ago #1
berkerpeksag
https://bugs.python.org/review/19475/diff/15278/Lib/datetime.py File Lib/datetime.py (right): https://bugs.python.org/review/19475/diff/15278/Lib/datetime.py#newcode1563 Lib/datetime.py:1563: def isoformat(self, sep='T', timespec='auto'): We can make timespec a ...
2 years, 2 months ago #2
acucci
@haypo and @berkerpeksag, i have added two comments cause i'm not sure what to do. ...
2 years, 2 months ago #3
berkerpeksag
https://bugs.python.org/review/19475/diff/15278/Lib/datetime.py File Lib/datetime.py (right): https://bugs.python.org/review/19475/diff/15278/Lib/datetime.py#newcode1587 Lib/datetime.py:1587: s = ("%04d-%02d-%02d%c" % (self._year, self._month, self._day, sep) + ...
2 years, 2 months ago #4
haypo
https://bugs.python.org/review/19475/diff/15278/Lib/datetime.py File Lib/datetime.py (right): https://bugs.python.org/review/19475/diff/15278/Lib/datetime.py#newcode1587 Lib/datetime.py:1587: s = ("%04d-%02d-%02d%c" % (self._year, self._month, self._day, sep) + ...
2 years, 2 months ago #5
acucci
http://bugs.python.org/review/19475/diff/15278/Lib/datetime.py File Lib/datetime.py (right): http://bugs.python.org/review/19475/diff/15278/Lib/datetime.py#newcode1592 Lib/datetime.py:1592: else: On 2015/07/31 17:01:19, haypo wrote: > You must ...
2 years, 2 months ago #6
sasha
http://bugs.python.org/review/19475/diff/15330/Lib/datetime.py File Lib/datetime.py (right): http://bugs.python.org/review/19475/diff/15330/Lib/datetime.py#newcode1584 Lib/datetime.py:1584: if timespec not in ('auto', 'hours', 'minutes', 'seconds', 'microseconds'): ...
1 year, 10 months ago #7
ghost.adh_gmail.com
https://bugs.python.org/review/19475/diff/15330/Lib/datetime.py File Lib/datetime.py (right): https://bugs.python.org/review/19475/diff/15330/Lib/datetime.py#newcode1578 Lib/datetime.py:1578: ‘auto’: Append microseconds except if microsecond is 0. I ...
1 year, 10 months ago #8
Martin Panter
https://bugs.python.org/review/19475/diff/15278/Lib/test/datetimetester.py File Lib/test/datetimetester.py (right): https://bugs.python.org/review/19475/diff/15278/Lib/test/datetimetester.py#newcode1504 Lib/test/datetimetester.py:1504: t = self.theclass(1, 2, 3, 4, 5, 1, 123) ...
1 year, 10 months ago #9
acucci
http://bugs.python.org/review/19475/diff/15330/Doc/library/datetime.rst File Doc/library/datetime.rst (right): http://bugs.python.org/review/19475/diff/15330/Doc/library/datetime.rst#newcode1170 Doc/library/datetime.rst:1170: On 2015/12/15 22:06:31, vadmium wrote: > Needs a version ...
1 year, 10 months ago #10
acucci
http://bugs.python.org/review/19475/diff/15330/Lib/datetime.py File Lib/datetime.py (right): http://bugs.python.org/review/19475/diff/15330/Lib/datetime.py#newcode1584 Lib/datetime.py:1584: if timespec not in ('auto', 'hours', 'minutes', 'seconds', 'microseconds'): ...
1 year, 10 months ago #11
ghost.adh_gmail.com
On 2015/12/16 21:14:25, acucci wrote: > http://bugs.python.org/review/19475/diff/15330/Lib/datetime.py > File Lib/datetime.py (right): > > http://bugs.python.org/review/19475/diff/15330/Lib/datetime.py#newcode1584 > ...
1 year, 10 months ago #12
Martin Panter
https://bugs.python.org/review/19475/diff/15330/Doc/library/datetime.rst File Doc/library/datetime.rst (right): https://bugs.python.org/review/19475/diff/15330/Doc/library/datetime.rst#newcode1170 Doc/library/datetime.rst:1170: On 2015/12/16 21:07:01, acucci wrote: > On 2015/12/15 22:06:31, ...
1 year, 10 months ago #13
ghost.adh_gmail.com
https://bugs.python.org/review/19475/diff/16171/Lib/datetime.py File Lib/datetime.py (right): https://bugs.python.org/review/19475/diff/16171/Lib/datetime.py#newcode157 Lib/datetime.py:157: # Skip trailing microseconds when us==0. This comment is ...
1 year, 10 months ago #14
Martin Panter
https://bugs.python.org/review/19475/diff/16171/Doc/library/datetime.rst File Doc/library/datetime.rst (right): https://bugs.python.org/review/19475/diff/16171/Doc/library/datetime.rst#newcode1169 Doc/library/datetime.rst:1169: ... Drop this blank line https://bugs.python.org/review/19475/diff/16171/Doc/library/datetime.rst#newcode1170 Doc/library/datetime.rst:1170: >>> datetime.datetime.now().isoformat(timespec='minutes') ...
1 year, 10 months ago #15
acucci
http://bugs.python.org/review/19475/diff/16171/Lib/datetime.py File Lib/datetime.py (right): http://bugs.python.org/review/19475/diff/16171/Lib/datetime.py#newcode157 Lib/datetime.py:157: # Skip trailing microseconds when us==0. On 2015/12/16 23:16:19, ...
1 year, 10 months ago #16
Martin Panter
http://bugs.python.org/review/19475/diff/16171/Lib/datetime.py File Lib/datetime.py (right): http://bugs.python.org/review/19475/diff/16171/Lib/datetime.py#newcode157 Lib/datetime.py:157: # Skip trailing microseconds when us==0. On 2015/12/17 09:18:16, ...
1 year, 10 months ago #17
acucci
http://bugs.python.org/review/19475/diff/16171/Lib/datetime.py File Lib/datetime.py (right): http://bugs.python.org/review/19475/diff/16171/Lib/datetime.py#newcode157 Lib/datetime.py:157: # Skip trailing microseconds when us==0. On 2015/12/17 09:30:25, ...
1 year, 10 months ago #18
ghost.adh_gmail.com
https://bugs.python.org/review/19475/diff/16206/Doc/library/datetime.rst File Doc/library/datetime.rst (right): https://bugs.python.org/review/19475/diff/16206/Doc/library/datetime.rst#newcode1176 Doc/library/datetime.rst:1176: >>> dt.isoformat(timespec='nanoseconds') output missing https://bugs.python.org/review/19475/diff/16206/Lib/datetime.py File Lib/datetime.py (right): https://bugs.python.org/review/19475/diff/16206/Lib/datetime.py#newcode156 ...
1 year, 10 months ago #19
ghost.adh_gmail.com
https://bugs.python.org/review/19475/diff/16206/Doc/library/datetime.rst File Doc/library/datetime.rst (right): https://bugs.python.org/review/19475/diff/16206/Doc/library/datetime.rst#newcode1158 Doc/library/datetime.rst:1158: terms of the time to include. It can be ...
1 year, 10 months ago #20
ghost.adh_gmail.com
https://bugs.python.org/review/19475/diff/16213/Doc/library/datetime.rst File Doc/library/datetime.rst (right): https://bugs.python.org/review/19475/diff/16213/Doc/library/datetime.rst#newcode1177 Doc/library/datetime.rst:1177: Milliseconds, microseconds and nanoseconds are displayed only if microsecond ...
1 year, 10 months ago #21
ghost.adh_gmail.com
> http://bugs.python.org/review/19475/diff/15330/Lib/datetime.py#newcode1595 > Lib/datetime.py:1595: else: > On 2015/12/15 22:06:31, vadmium wrote: > > It seems ...
1 year, 10 months ago #22
ghost.adh_gmail.com
https://bugs.python.org/review/19475/diff/16220/Doc/library/datetime.rst File Doc/library/datetime.rst (right): https://bugs.python.org/review/19475/diff/16220/Doc/library/datetime.rst#newcode1166 Doc/library/datetime.rst:1166: ValueError will be raised on invalid timespec argument. I'm ...
1 year, 10 months ago #23
berkerpeksag
http://bugs.python.org/review/19475/diff/16235/Doc/library/datetime.rst File Doc/library/datetime.rst (right): http://bugs.python.org/review/19475/diff/16235/Doc/library/datetime.rst#newcode1157 Doc/library/datetime.rst:1157: The optional argument *timespec* specifies the number of additional ...
1 year, 9 months ago #24
ghost.adh_gmail.com
https://bugs.python.org/review/19475/diff/16235/Doc/library/datetime.rst File Doc/library/datetime.rst (right): https://bugs.python.org/review/19475/diff/16235/Doc/library/datetime.rst#newcode1180 Doc/library/datetime.rst:1180: .. versionadded:: 3.6 On 2015/12/29 17:05:41, berkerpeksag wrote: > ...
1 year, 9 months ago #25
Martin Panter
https://bugs.python.org/review/19475/diff/16235/Doc/library/datetime.rst File Doc/library/datetime.rst (right): https://bugs.python.org/review/19475/diff/16235/Doc/library/datetime.rst#newcode1180 Doc/library/datetime.rst:1180: .. versionadded:: 3.6 On 2015/12/29 17:05:41, berkerpeksag wrote: > ...
1 year, 9 months ago #26
acucci
http://bugs.python.org/review/19475/diff/16249/Doc/library/datetime.rst File Doc/library/datetime.rst (right): http://bugs.python.org/review/19475/diff/16249/Doc/library/datetime.rst#newcode1174 Doc/library/datetime.rst:1174: '2015-01-01T12:30:59.123' On 2016/01/01 11:37:32, vadmium wrote: > Three decimal ...
1 year, 9 months ago #27
sasha
http://bugs.python.org/review/19475/diff/16260/Doc/library/datetime.rst File Doc/library/datetime.rst (right): http://bugs.python.org/review/19475/diff/16260/Doc/library/datetime.rst#newcode1136 Doc/library/datetime.rst:1136: .. method:: datetime.isoformat(sep='T', timespec='auto') The two paragraphs below are ...
1 year, 9 months ago #28
Martin Panter
http://bugs.python.org/review/19475/diff/16260/Modules/_datetimemodule.c File Modules/_datetimemodule.c (left): http://bugs.python.org/review/19475/diff/16260/Modules/_datetimemodule.c#oldcode3853 Modules/_datetimemodule.c:3853: PyDoc_STR("Return string in ISO 8601 format, HH:MM:SS[.mmmmmm]" IMO this ...
1 year, 9 months ago #29
Martin Panter
https://bugs.python.org/review/19475/diff/16235/Doc/library/datetime.rst File Doc/library/datetime.rst (right): https://bugs.python.org/review/19475/diff/16235/Doc/library/datetime.rst#newcode1180 Doc/library/datetime.rst:1180: .. versionadded:: 3.6 On 2015/12/29 17:47:34, SilentGhost wrote: > ...
1 year, 8 months ago #30
acucci
http://bugs.python.org/review/19475/diff/16631/Doc/library/datetime.rst File Doc/library/datetime.rst (right): http://bugs.python.org/review/19475/diff/16631/Doc/library/datetime.rst#newcode1166 Doc/library/datetime.rst:1166: - ``'milliseconds'``: Append the hours, minutes, seconds and milliseconds. ...
1 year, 8 months ago #31
sasha
http://bugs.python.org/review/19475/diff/16656/Doc/library/datetime.rst File Doc/library/datetime.rst (right): http://bugs.python.org/review/19475/diff/16656/Doc/library/datetime.rst#newcode1172 Doc/library/datetime.rst:1172: its value will be truncated to that precision. "that ...
1 year, 7 months ago #32
ghost.adh_gmail.com
1 year, 7 months ago #33
https://bugs.python.org/review/19475/diff/16656/Lib/datetime.py
File Lib/datetime.py (right):

https://bugs.python.org/review/19475/diff/16656/Lib/datetime.py#newcode168
Lib/datetime.py:168: if timespec not in specs:
On 2016/03/01 20:20:08, sasha wrote:
> Better:
> 
> try:
>    fmt = specs[timespec]
> except KeyError:
>    raise ValueError('Unknown timespec value')
> else:
>    ...

This exposes underlining error.
That is, you'd get: "During handling of the above exception, ..."
Sign in to reply to this message.

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7