You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
msg107191 belongs to bpo-8903, not here and it is not a use case, but rather a demonstration of how the proposed feature would work.
My question is why would an application need current time without current date? I feel providing time.now() may lead so people to call date.today() and time.now() separately instead of datetime.now() leading to interesting bugs.
One think I would consider an improvement over the current situation, would be to rename date.today() to date.now(). There are too many ways to spell the same thing:
I need to correct myself: datetime.today() is not an alternative spelling of date.today(), but rather a function returning current datetime which subtly different from datetime.now().
Closing for the lack of interest. Proposed time.now() is already available as datetime.now().time(). No use case justifying any improvement in this area was presented.
Activity
techtonik commentedon Jun 5, 2010
There is:
datetime.date.today()
datetime.datetime.today()
datetime.datetime.now([tz])
But no:
datetime.time.now([tz])
abalkin commentedon Jun 6, 2010
Anatoly,
Didn't you just recently complain about the large number of functions in datetime module? (bpo-7584)
datetime.datetime.now().time() seems adequate to me.
What is your use case?
techtonik commentedon Jun 6, 2010
techtonik commentedon Jun 6, 2010
About verbosity of datetime API to be exact, so it is a ratio of (API functions + required docs)/user code that makes required stuff done.
abalkin commentedon Jun 8, 2010
Anatoly,
msg107191 belongs to bpo-8903, not here and it is not a use case, but rather a demonstration of how the proposed feature would work.
My question is why would an application need current time without current date? I feel providing time.now() may lead so people to call date.today() and time.now() separately instead of datetime.now() leading to interesting bugs.
One think I would consider an improvement over the current situation, would be to rename date.today() to date.now(). There are too many ways to spell the same thing:
and no easy way to write a "how long ago" function that would work for both date and datetime:
abalkin commentedon Oct 8, 2010
I need to correct myself: datetime.today() is not an alternative spelling of date.today(), but rather a function returning current datetime which subtly different from datetime.now().
abalkin commentedon Jun 7, 2012
Closing for the lack of interest. Proposed time.now() is already available as datetime.now().time(). No use case justifying any improvement in this area was presented.
techtonik commentedon Jun 7, 2012
I'd say no consensus was reached due to lack of participation. My enthusiasm was killed by the bpo-8903 resolution.
My opinion is that:
datetime.time.now()
is much better than:
datetime.datetime.now().time()
techtonik commentedon Jun 7, 2012
And I certainly don't agree with you that usability changes in API are not use cases.
abalkin commentedon Jun 29, 2014
I would like to bring this issue to some conclusion. Here is the summary:
Pro:
datetime.time.now() is shorter than datetime.datetime.now().time()
Cons:
date, time = datetime.date.today(), datetime.time.now() is attractive, but wrong.
time detached from date is a strange object with limited support in datetime module (no timedelta arithmetics, bpo-17267; tzinfo issues; etc.)
No compelling use cases have been presented.
rhettinger commentedon Jun 30, 2014
For the reasons listed by others, marking this as closed/rejected.