[issue29690] no %z directive for strptime in python2, doc says nothing about it

2017-03-05 Thread Mathieu Dupuy

Mathieu Dupuy added the comment:

Neither documentation is clear on whether each of those flags are available for 
strptime too. A precision should be added on a flag if it's not available for 
strptime. What do you think ?

--

___
Python tracker 

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



[issue29690] no %z directive for strptime in python2, doc says nothing about it

2017-03-02 Thread R. David Murray

R. David Murray added the comment:

This almost qualifies as a FAQ :)

In 2.7 (and in 3.x, though we've added some additional platform independent 
stuff there), strptime supports what the platform supports, and this is 
documented: "The following is a list of all the format codes that the C 
standard (1989 version) requires, and these work on all platforms with a 
standard C implementation. Note that the 1999 version of the C standard added 
additional format codes."

Windows, for one, is not a standard C implementation in that sense.

Note that the python3 documentation is a bit clearer about this than the 2.7 
docs.  If you want to open a PR to backport the doc improvements, feel free to 
reopen this issue.

--
nosy: +r.david.murray
resolution:  -> not a bug
stage:  -> 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



[issue29690] no %z directive for strptime in python2, doc says nothing about it

2017-03-01 Thread Mathieu Dupuy

New submission from Mathieu Dupuy:

➜  ~ cat dt.py 
from datetime import *
dt = datetime.strptime('+1720', '%z')
print(dt)
➜  ~ python2 dt.py 
Traceback (most recent call last):
  File "dt.py", line 2, in 
dt = datetime.strptime('+1720', '%z')
  File "/usr/lib/python2.7/_strptime.py", line 324, in _strptime
(bad_directive, format))
ValueError: 'z' is a bad directive in format '%z'
➜  ~ python3 dt.py
1900-01-01 00:00:00+17:20

We should either mention it in doc, either cherry-pick the code from python3

--
components: Library (Lib)
messages: 288782
nosy: deronnax
priority: normal
severity: normal
status: open
title: no %z directive for strptime in python2, doc says nothing about it
type: behavior
versions: Python 2.7

___
Python tracker 

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