Message83453
| Author |
belopolsky |
| Recipients |
amaury.forgeotdarc, belopolsky, fredrikj, jribbens, mark.dickinson, tleeuwenburg@gmail.com, vstinner, webograph |
| Date |
2009年03月11日.03:33:40 |
| SpamBayes Score |
6.961152e-09 |
| Marked as misclassified |
No |
| Message-id |
<d38f5330903102033q760a8eb8u84e2b9d3f5e8e01d@mail.gmail.com> |
| In-reply-to |
<1236719757.32.0.275185773952.issue2706@psf.upfronthosting.co.za> |
| Content |
On Tue, Mar 10, 2009 at 5:15 PM, Tennessee Leeuwenburg
<report@bugs.python.org> wrote:
..
> 2) Allow divmod, the operator '%', to be applied to two timedeltas (e.g.
> td1 % td2). I think there is some debate here about whether the return
> value be an integer in microsends, or a timedelta. I personally believe
> that a timedelta should be returned, representing the amount of time
> remaining after (td1 // td2) * td2 has been subtracted.
>
> The alternative is an integer, but due to a lack of immediate clarity
> over what time quanta this integer represents, I would suggest returning
> a unit amount. There is also some discussion of returning (long,
> timedelta), but I personally fail to see the merits of returning the
> long without some unit attached.
>
I don't think this alternative was ever seriously considered and no
patch was ever proposed to do it that way. Victor's latest patch
implements divmod(timedelta, timedelta) -> (int, timedelta) and
therefore timedelta % timedelta -> timedelta. |
|