On 2/26/2019 7:03 PM, Chris Barker via Python-Dev wrote:

So: it would be good to provide a correct, simple,  intuitive, and discoverable way to do that.

timedelta.total_seconds()

To me, total_x implies that there is a summation of multiple timedeltas, and there is not. So not intuitive to me. (Neither us current obscure option). It is also not obvious is answer is rounded to nearest second or not.


So at most, we could have:

.total_microseconds()
.total_seconds()
.total_minutes()
.total_hours()
.total_days()
.total_weeks()

I am also not enthusiastic about multiple methods doing essentially the same thing. I might prefer one method, .convert? with an argument specifying the conversion unit, 'microseconds', 'seconds', ... . I think this is in python-ideas territory.



--
Terry Jan Reedy


_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to