Author Alexander.Belopolsky
Recipients Alexander.Belopolsky, Neil Muller, amaury.forgeotdarc, andersjm, belopolsky, catlee, davidfraser, erik.stephens, guettli, hodgestar, jribbens, mark.dickinson, pitrou, srittau, steve.roberts, tebeka, tim.peters, tomster, vstinner, werneck
Date 2010-05-21.16:06:04
SpamBayes Score 2.69417e-05
Marked as misclassified No
Message-id <AANLkTilqa2e3wW2V3iiv_ZUtJnWGsubcCq7EM-MF8aiJ@mail.gmail.com>
In-reply-to <1274441860.07.0.675362024741.issue2736@psf.upfronthosting.co.za>
Content
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?
History
Date User Action Args
2010-05-21 16:06:09Alexander.Belopolskysetrecipients: + 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:05Alexander.Belopolskylinkissue2736 messages
2010-05-21 16:06:04Alexander.Belopolskycreate