Roy Smith added the comment:

I see I mis-stated my example.  When I wrote:

s = str(d1)
d2 = datetime.datetime(s)
assert d1 == d2

what I really meant was:

s = d1.isoformat()
d2 = datetime.datetime(s)
assert d1 == d2

But, now I realize that while that is certainly an absolute lower bound, it's 
almost certainly not sufficient.  The most common use case I see on a daily 
basis is parsing strings that look like "2012-09-07T23:59:59+00:00".  This is 
also John Nagle's original use case from the cited mailing list thread:

> I want to parse standard ISO date/time strings such as
>     2012-09-09T18:00:00-07:00

Datetime.isoformat() returns something that matches the beginning of that, but 
doesn't have the time zone offset.  And it's the offset that makes strptime() 
not usable as a soluation, because "%z" isn't portable.

If we don't satisfy the "2012-09-07T23:59:59+00:00" case, then we won't have 
really done anything useful.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue15873>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to