I was wondering why have restrictions on the datetime.time constructor
arguments?  For example, why can't you enter 1.5 minutes or 90 seconds to
create a datetime object with 1 minute and 30 seconds?

>>> datetime.time(minute=1.5)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: integer argument expected, got float

>>> datetime.time(second=90)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: second must be in 0..59

I'd like to use datetime.time for time conversions like this.  It seems
silly to have to do all the math and sanitize the inputs manually.  If I
have to do all that work myself, then why use this module at all?  Is there
another module or function that I am missing?

Thanks,
Ben
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/RNZYOHG4OM4DHNZRZBOYL7CYAXD7WV3E/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to