Author deronnax
Recipients Alexander.Belopolsky, Anders.Hovmöller, Arfrever, barry, belopolsky, berker.peksag, cvrebert, davydov, deronnax, eric.araujo, flying sheep, jcea, jstasiak, jwilk, karlcow, kirpit, martin.panter, mcepl, mihaic, nagle, pbryan, perey, piotr.dobrogost, r.david.murray, roysmith, vstinner
Date 2016-02-15.11:41:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1455536467.31.0.322715991279.issue15873@psf.upfronthosting.co.za>
In-reply-to
Content
> Hum, you should use the same rounding method than
datetime.datetime.fromtimestamp(): ROUND_HALF_UP, as round().
In practice, you can for example pass a floating point number as
microseconds to datetime.datetime constructor.

Unfortunately, you're mistaking with the timedelta constructor. Datetime's one only take int :(
But I figured out an elegant manner to cope with (in my opinion)

> Since datetime is implemented in C, I'm not sure that using the re is
the best choice. Since the regex looks simple enough, we may parse the
string without the re module. Well, maybe only for the C
implementation.

No regex available at all in CPython ? Otherwise, yeah, if I have to, I can do it with strptime.

> What is the behaviour is there are spaces before/after the string?
What if there are other characters like letters before/after? You
should add an unit test for that. I expect an error when parsing
"t=2012-04-23T09:15:00" for example.
Your regex ends with $ but doesn't start with ^. Using re.match(), ^
and $ are probably not needed, but I'm not confident when I use regex
:-)

re.match only look at the beginning of the string, so no need for '^'. And therefore, the case
you mention is already handled :)

joined to this mail the last revision of the feature, with correct rounding, more test and one useless
line removed. Maybe the good one :) ?
History
Date User Action Args
2016-02-15 11:41:07deronnaxsetrecipients: + deronnax, barry, jcea, roysmith, belopolsky, nagle, vstinner, jwilk, mcepl, eric.araujo, Arfrever, r.david.murray, davydov, cvrebert, karlcow, Alexander.Belopolsky, perey, flying sheep, mihaic, berker.peksag, martin.panter, piotr.dobrogost, kirpit, Anders.Hovmöller, jstasiak, pbryan
2016-02-15 11:41:07deronnaxsetmessageid: <1455536467.31.0.322715991279.issue15873@psf.upfronthosting.co.za>
2016-02-15 11:41:07deronnaxlinkissue15873 messages
2016-02-15 11:41:06deronnaxcreate