| Paste number 43332: | couldn't add this comment to http://trac.edgewall.org/ticket/4547#preview |
| Pasted by: | bewst |
| When: | 2 years, 1 week ago |
| Share: | Tweet this! | http://paste.lisp.org/+XFO |
| Channel: | #trac |
| Paste contents: |
Replying to [comment:13 cboos]:
> See attachment:datefmt-r5696.diff
>
> I've renamed `_normalize` to `to_datetime`, which is reminiscent of `to_unicode` as it serves the same kind of normalization purpose (here: datetime/timestamps -> datetime).
The code looks OK, but the comments still leave me scratching my head. For example,
{{{
64 """Calculate time delta between two `datetime` objects.
65 (the result is somewhat imprecise, only use for prettyprinting).
66
67 If either `time1` or `time2` is None, the current time will be used
68 instead.
69
}}}
This code doesn't operate on {{{datetime}}} objects. Like much of the rest of this file, it's a generic function operating on “TimePoints,” where a TimePoint is either:
a. A {{{datetime}}} object
b. An {{{int}}}, {{{long}}}, or {{{float}}} in which case it is interpreted ''thus'' (you write).
c. or {{{None}}}, in which case it is interpreted as “right now.”
OK, we're talking about essentially saying that b) above is unsupported and will cease to work in a future version. Sorry for the rambling; I lack sleep.
I guess we still need to decide whether we're supporting c). Do you really want to allow people to pass {{{None}}} here? If so, what makes {{{int}}}, {{{long}}}, and {{{float}}} different? If you don't support that, you can simplify your docs. This paste has no annotations.