Movatterモバイル変換


[0]ホーム

URL:


homepage

Message106389

This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Authorbelopolsky
Recipientsbelopolsky, mark.dickinson, mcherm, rhettinger, stutzbach, tim.peters, vstinner
Date2010-05-24.20:54:59
SpamBayes Score0.0057165236
Marked as misclassifiedNo
Message-id<1274734501.23.0.244623376207.issue1289118@psf.upfronthosting.co.za>
In-reply-to
Content
Indeed.  Here is what I intended:""">>> from datetime import timedelta as d>>> [d(microseconds=i + .5)//d.resolution for i in range(-10,10)][-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]Should this be considered a bug?For comparison,>>> [d.resolution*(i+0.5)//d.resolution for i in range(-10,10)][-10, -8, -8, -6, -6, -4, -4, -2, -2, 0, 0, 2, 2, 4, 4, 6, 6, 8, 8, 10]and>>> [round(i+0.5) for i in range(-10,10)][-10, -8, -8, -6, -6, -4, -4, -2, -2, 0, 0, 2, 2, 4, 4, 6, 6, 8, 8, 10]"""I checked the documentation and while it says: "If any argument is a float and there are fractional microseconds, the fractional microseconds left over from all arguments are combined and their sum is rounded to the nearest microsecond." it does not specify how half-integers should be handled.While it may not be a bug in strict sense, it looks like the code in question can be improved.  I'll open a separate issue for this.
History
DateUserActionArgs
2010-05-24 20:55:01belopolskysetrecipients: +belopolsky,tim.peters,mcherm,rhettinger,mark.dickinson,vstinner,stutzbach
2010-05-24 20:55:01belopolskysetmessageid: <1274734501.23.0.244623376207.issue1289118@psf.upfronthosting.co.za>
2010-05-24 20:54:59belopolskylinkissue1289118 messages
2010-05-24 20:54:59belopolskycreate
Supported byThe Python Software Foundation,
Powered byRoundup
Copyright © 1990-2022,Python Software Foundation
Legal Statements

[8]ページ先頭

©2009-2026 Movatter.jp