Anders Hovmöller added the comment:
Éric Araujo: absolutely. Although I think my code can be improved (speed wise,
elegance, etc) since I just wrote it quickly a weekend :)
--
___
Python tracker rep...@bugs.python.org
Éric Araujo added the comment:
Are you offering the module for inclusion in the stdlib?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15873
___
Anders Hovmöller added the comment:
I've written a parser for ISO 8601: https://github.com/boxed/iso8601
Some basic tests are included and it supports most of the standard. Haven't
gotten around to the more obscure parts like durations and intervals, but those
are trivial to add...
Changes by Éric Araujo mer...@netwok.org:
--
nosy: +eric.araujo
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15873
___
___
Python-bugs-list
Changes by kirpit kir...@gmail.com:
--
nosy: +kirpit
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15873
___
___
Python-bugs-list mailing list
flying sheep added the comment:
there is a module that parses those strings pretty nicely, it’s called
pyiso8601: http://code.google.com/p/pyiso8601/
in the context of writing a better plistlib, i also needed the capability to
parse those strings, and decided not to use the sucky incomplete
Changes by Matej Cepl mc...@redhat.com:
--
nosy: +mcepl
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15873
___
___
Python-bugs-list mailing list
Roy Smith added the comment:
I've started collecting some test cases. I'll keep adding to the collection.
I'm going to start trolling ISO 8601:2004(E) for more. Let me know if there
are other sources I should be considering.
--
___
Python
Roy Smith added the comment:
Ooops, clicked the wrong button.
--
Added file: http://bugs.python.org/file27165/test-cases.py
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15873
___
Roy Smith added the comment:
We need to define the scope of what input strings will be accepted. ISO-8601
defines a lot of stuff which we may not wish to accept.
Do we want to accept both basic format (MMDD) and extended format
(-MM-DD)?
Do we want to accept things like 1985-W15-5,
Alexander Belopolsky added the comment:
On Sep 9, 2012, at 8:15 AM, Roy Smith rep...@bugs.python.org wrote:
We need to define the scope of what input strings will be accepted.
Since it is easier to widen the domain of acceptable arguments than to narrow
it in the future, I would say let's
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
John Nagle added the comment:
For what parts of ISO 8601 to accept, there's a standard: RFC3339, Date and
Time on the Internet: Timestamps. See section 5.6:
date-fullyear = 4DIGIT
date-month = 2DIGIT ; 01-12
date-mday = 2DIGIT ; 01-28, 01-29, 01-30, 01-31 based on
Alexander Belopolsky added the comment:
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 exactly what isoformat() of an
Alexander Belopolsky added the comment:
For what parts of ISO 8601 to accept, there's a standard: RFC3339
This is almost indistinguishable from the idea of accepting .isoformat() and
str() results. From what I see the only difference is that 't' is accepted for
date/time separator and 'z'
Changes by Jesús Cea Avión j...@jcea.es:
--
nosy: +jcea
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15873
___
___
Python-bugs-list mailing list
Changes by Alexander Belopolsky alexander.belopol...@gmail.com:
--
assignee: - belopolsky
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15873
___
Changes by Chris Rebert pyb...@rebertia.com:
--
nosy: +cvrebert
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15873
___
___
Python-bugs-list
New submission from John Nagle:
The datetime module has support for output to a string of dates and times in
ISO 8601 format (2012-09-09T18:00:00-07:00), with the object method
isoformat([sep]). But there's no support for parsing such strings. A string
to datetime class method should be
Changes by STINNER Victor victor.stin...@gmail.com:
--
nosy: +belopolsky
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15873
___
___
Changes by R. David Murray rdmur...@bitdance.com:
--
versions: -Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15873
___
Changes by R. David Murray rdmur...@bitdance.com:
--
nosy: +r.david.murray
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15873
___
___
Alexander Belopolsky added the comment:
%z format is supported, but it cannot accept colon in TZ offset. It can parse
offsets like -0600 just fine. What OP is looking for is the GNU date %:z
format which datetime does not support.
For ISO 8601 compliance, however I think we need a way to
Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:
--
nosy: +Arfrever
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15873
___
John Nagle added the comment:
Re: %z format is supported.
That's platform-specific; the actual parsing is delegated to the C library.
It's not in Python 2.7 / Win32:
ValueError: 'z' is a bad directive in format '%Y-%m-%dT%H:%M:%S%z'
It really shouldn't be platform-specific; the underlying
Alexander Belopolsky added the comment:
On Thu, Sep 6, 2012 at 9:51 PM, John Nagle rep...@bugs.python.org wrote:
It's not in Python 2.7 / Win32.
Python 2.x series is closed and cannot accept new features. Both %z
and fixed offset tzinfo subclass are implemented in 3.2.
--
Alexander Belopolsky added the comment:
I am attaching a quick python only prototype for the proposed feature. My goal
is to make date/time objects behave like numeric types for which constructors
accept strings produced by str(). Since str() format is ISO 8601, it is
natural to accept ISO
27 matches
Mail list logo