Message106251
On Fri, May 21, 2010 at 7:37 AM, Antoine Pitrou <report@bugs.python.org> wrote:
..
> I agree with Victor that the APIs need improving, even if it involves providing obvious replacements of obscure one-liners.
While I agree that the datetime API can be improved, I don't think
Victor's proposal does that. The advantage of an obscure one-liner is
that it is obvious what it does, particularly for someone with a
C/UNIX background. dt.totimestamp() may be easier to write, but it is
entirely non-obvious what it will return. One would expect that
dt.totimestamp() is the inverse of datetime.fromtimestamp(timestamp),
but in timezones with daylight savings adjustments, but such inverse
may not always exist. (01:59AM may be followed by 02:00 AM or by
01:00 AM. so on changeover days datetime(y, m, d, 1, 30).totimestamp()
is either ambiguous or undefined.) As I suggested in my previous
comment, this problem can be resolved, but we are not there yet.
> As an occasional user of datetime and time modules, I have too often wanted to curse those limited, awkwardly inconsistent APIs.
Yes, it would be ideal if a user of datetime module would not need to
reach to other modules for date/time calculations. See also
<http://bugs.python.org/issue6280>. Do you have other examples of
this sort? |
|
Date |
User |
Action |
Args |
2010-05-21 16:06:09 | Alexander.Belopolsky | set | recipients:
+ Alexander.Belopolsky, tim.peters, jribbens, srittau, guettli, amaury.forgeotdarc, tebeka, mark.dickinson, davidfraser, belopolsky, pitrou, andersjm, catlee, vstinner, tomster, werneck, hodgestar, Neil Muller, erik.stephens, steve.roberts |
2010-05-21 16:06:05 | Alexander.Belopolsky | link | issue2736 messages |
2010-05-21 16:06:04 | Alexander.Belopolsky | create | |
|