This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Alexander.Belopolsky
Recipients Alexander.Belopolsky, amaury.forgeotdarc, eric.araujo, fredrikj, jess.austin, jribbens, mark.dickinson, r.david.murray, tleeuwenburg@gmail.com, vstinner, webograph
Date 2010-04-20.01:23:21
SpamBayes Score 4.8128452e-09
Marked as misclassified No
Message-id <1271726604.25.0.649371474887.issue2706@psf.upfronthosting.co.za>
In-reply-to
Content
New patch, issue2706a.diff, implements timedelta % timedelta and addresses  Mark's code review comments.


With respect to Mark's
"""
One other thought:  with this division operation added, it might be nice to add constants like td_hour, td_minute, etc. to the module.  Then the perennial 'how can I convert my timedelta x to minutes' questions could be answered with 'just do x/td_minute'.  I would personally find x/td_second to be a more obvious and natural way to find the total number of seconds in a timedelta than x.total_seconds.  I also quite like the idea of being able to create a 2.5-hour timedelta with something like

2*td_hour + 30*td_minute

On the other hand, maybe such constants would just be added clutter, since it's easy to create them when needed.
"""

I dislike this proposal for the same reason as Mark likes it: 2*td_hour + 30*td_minute == timedelta(hours=2, minutes=30) is a violation of TOOWTDI.
History
Date User Action Args
2010-04-20 01:23:25Alexander.Belopolskysetrecipients: + Alexander.Belopolsky, jribbens, amaury.forgeotdarc, mark.dickinson, vstinner, jess.austin, fredrikj, webograph, eric.araujo, r.david.murray, tleeuwenburg@gmail.com
2010-04-20 01:23:24Alexander.Belopolskysetmessageid: <1271726604.25.0.649371474887.issue2706@psf.upfronthosting.co.za>
2010-04-20 01:23:22Alexander.Belopolskylinkissue2706 messages
2010-04-20 01:23:22Alexander.Belopolskycreate