[issue27741] datetime.datetime.strptime functionality description incorrect

2018-10-29 Thread STINNER Victor


STINNER Victor  added the comment:

Thanks Nicholas Colclasure for the bug report and Gus Goulart for the fix.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27741] datetime.datetime.strptime functionality description incorrect

2018-10-29 Thread miss-islington


miss-islington  added the comment:


New changeset 4ec427b005036dab0a380de20f31774394ca4dd6 by Miss Islington (bot) 
in branch '2.7':
bpo-27741: Better wording for datetime.strptime() (GH-9994)
https://github.com/python/cpython/commit/4ec427b005036dab0a380de20f31774394ca4dd6


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27741] datetime.datetime.strptime functionality description incorrect

2018-10-29 Thread miss-islington


miss-islington  added the comment:


New changeset a02bc719ebc496bc527e9e46de2f2e83f68bfd77 by Miss Islington (bot) 
in branch '3.7':
bpo-27741: Better wording for datetime.strptime() (GH-9994)
https://github.com/python/cpython/commit/a02bc719ebc496bc527e9e46de2f2e83f68bfd77


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27741] datetime.datetime.strptime functionality description incorrect

2018-10-29 Thread miss-islington


miss-islington  added the comment:


New changeset 0a53a067dc4eb86ecf94c50582b3e22359c601a9 by Miss Islington (bot) 
in branch '3.6':
bpo-27741: Better wording for datetime.strptime() (GH-9994)
https://github.com/python/cpython/commit/0a53a067dc4eb86ecf94c50582b3e22359c601a9


--
nosy: +miss-islington

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27741] datetime.datetime.strptime functionality description incorrect

2018-10-29 Thread miss-islington


Change by miss-islington :


--
pull_requests: +9531

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27741] datetime.datetime.strptime functionality description incorrect

2018-10-29 Thread miss-islington


Change by miss-islington :


--
pull_requests: +9530

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27741] datetime.datetime.strptime functionality description incorrect

2018-10-29 Thread miss-islington


Change by miss-islington :


--
pull_requests: +9529

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27741] datetime.datetime.strptime functionality description incorrect

2018-10-29 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset c0799ec973530ad2492bb1d6c7287ffc428f0348 by Victor Stinner (Gus 
Goulart) in branch 'master':
bpo-27741: Better wording for datetime.strptime() (GH-9994)
https://github.com/python/cpython/commit/c0799ec973530ad2492bb1d6c7287ffc428f0348


--
nosy: +vstinner

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27741] datetime.datetime.strptime functionality description incorrect

2018-10-19 Thread Gus Goulart


Change by Gus Goulart :


--
keywords: +patch
pull_requests: +9335
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27741] datetime.datetime.strptime functionality description incorrect

2018-10-19 Thread Gus Goulart


Gus Goulart  added the comment:

Thanks, Tal. I will open up a PR for it.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27741] datetime.datetime.strptime functionality description incorrect

2018-10-19 Thread Tal Einat


Tal Einat  added the comment:

I agree with Gus, such new wording would be great. Gus, would you like to make 
a PR?

I'd split the comparison into a second paragraph, and avoid the word "better", 
instead using something like "but datetime.strptime() also retains both 
microseconds and timezone data."

Note that such a change of the wording to "similar" rather than "equivalent" 
will also future-proof this wording from minor future changes to either 
function.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27741] datetime.datetime.strptime functionality description incorrect

2018-10-18 Thread Gus Goulart


Gus Goulart  added the comment:

As far as I can see, every time something changes on datetime.strptime(), it 
will invalidate that section of the documentation. On the other hand, I believe 
the comparison with datetime(*(time.strptime(date_string, format)[0:6])" is 
interesting and valuable to keep.
Given that, instead of "This is equivalent to [...]", I would suggest something 
like:
"This is similar to [...], but datetime.strptime() is better since it retains 
both microseconds and timezone data."

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27741] datetime.datetime.strptime functionality description incorrect

2018-10-12 Thread Tal Einat


Tal Einat  added the comment:

At least with Python 3.7.0, the equivalence is not complete: 
datetime.strptime() is better, since it retains both microseconds and timezone 
data. See examples below.

>>> from datetime import datetime, timezone
>>> import time
>>> s = datetime.strftime(datetime.now(), '%a %b %d %H:%M:%S %f')
>>> s
'Fri Oct 12 11:33:32 999810'
>>> datetime.strptime(s, '%a %b %d %H:%M:%S %f')
datetime.datetime(1900, 10, 12, 11, 33, 32, 999810)
>>> datetime(*time.strptime(s, '%a %b %d %H:%M:%S %f')[:6])
datetime.datetime(1900, 10, 12, 11, 33, 32)
>>> s2 = datetime.strftime(datetime.now(timezone(timedelta(hours=1))), '%a %b 
>>> %d %H:%M:%S %f%z')
>>> s2
'Fri Oct 12 09:48:40 347076+0100'
>>> datetime.strptime(s2, '%a %b %d %H:%M:%S %f%z')
datetime.datetime(1900, 10, 12, 9, 48, 40, 347076, 
tzinfo=datetime.timezone(datetime.timedelta(seconds=3600)))
>>> datetime(*time.strptime(s2, '%a %b %d %H:%M:%S %f%z')[:6])
datetime.datetime(1900, 10, 12, 9, 48, 40)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27741] datetime.datetime.strptime functionality description incorrect

2018-10-11 Thread Ned Deily


Change by Ned Deily :


--
nosy: +belopolsky

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27741] datetime.datetime.strptime functionality description incorrect

2018-10-11 Thread Gus Goulart


Change by Gus Goulart :


--
nosy: +taleinat

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27741] datetime.datetime.strptime functionality description incorrect

2018-10-11 Thread Gus Goulart


Gus Goulart  added the comment:

It is true that time.srtptime() does not return microseconds, but as the 
documentation suggests, it will return the microseconds after you wrap it up 
with datetime().
I have attached a walkthrough of how I see that section of the docs. Please let 
me know if you have anything else in mind. Thanks!

--
nosy: +gus
Added file: https://bugs.python.org/file47863/datetime_docs.PNG

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27741] datetime.datetime.strptime functionality description incorrect

2018-07-15 Thread Farhaan Bukhsh


Farhaan Bukhsh  added the comment:

Hey I would like to remove this bug I was going through the discussion so does 
that mean remove the about mentioned lines from 

https://docs.python.org/3/library/datetime.html#datetime.datetime.strptime

will fix this issue? Or should we add some more information there?

--
nosy: +fhackdroid

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27741] datetime.datetime.strptime functionality description incorrect

2018-07-13 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

The same part repeated at 
https://docs.python.org/3/library/datetime.html#strftime-and-strptime-behavior 
can also be corrected. It seems both of them use _strptime which returns 
microseconds but only datetime.datetime.strptime uses it with time.strptime 
ignoring it.

Thanks

--
nosy: +xtreak

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27741] datetime.datetime.strptime functionality description incorrect

2018-07-05 Thread Paul Ganssle


Change by Paul Ganssle :


--
nosy: +p-ganssle

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27741] datetime.datetime.strptime functionality description incorrect

2016-08-11 Thread Nicholas Colclasure

New submission from Nicholas Colclasure:

The datetime.datetime.strptime documentation states that it is equivalent to 
datetime(*(time.strptime(date_string, format)[0:6])), but the time.struct_time 
returned by time.strptime does not include microseconds, implying that 
datetime's strptime would also not include microseconds, but testing of the 
functions shows that it does include them.

Removing the false statement of equivalence would be enough to remove this bug 
from the documentation.

--
assignee: docs@python
components: Documentation
messages: 272474
nosy: Valectar, docs@python
priority: normal
severity: normal
status: open
title: datetime.datetime.strptime functionality description incorrect
type: behavior
versions: Python 3.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com