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.
Created on 2010年06月05日 06:36 by techtonik, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Messages (11) | |||
|---|---|---|---|
| msg107122 - (view) | Author: anatoly techtonik (techtonik) | Date: 2010年06月05日 06:36 | |
There is: datetime.date.today() datetime.datetime.today() datetime.datetime.now([tz]) But no: datetime.time.now([tz]) |
|||
| msg107166 - (view) | Author: Alexander Belopolsky (belopolsky) * (Python committer) | Date: 2010年06月06日 00:11 | |
Anatoly, Didn't you just recently complain about the large number of functions in datetime module? (issue7584) datetime.datetime.now().time() seems adequate to me. What is your use case? |
|||
| msg107191 - (view) | Author: anatoly techtonik (techtonik) | Date: 2010年06月06日 08:19 | |
> What is your use case? >>> from datetime import now, today >>> now() datetime.time ... >>> today() datetime.date ... |
|||
| msg107192 - (view) | Author: anatoly techtonik (techtonik) | Date: 2010年06月06日 08:21 | |
> Didn't you just recently complain about the large number of functions in datetime module? 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. |
|||
| msg107331 - (view) | Author: Alexander Belopolsky (belopolsky) * (Python committer) | Date: 2010年06月08日 17:59 | |
Anatoly, msg107191 belongs to issue8903, 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: date.today() datetime.today() datetime.now().date() and no easy way to write a "how long ago" function that would work for both date and datetime: def ago(t): t.now() - t |
|||
| msg118216 - (view) | Author: Alexander Belopolsky (belopolsky) * (Python committer) | Date: 2010年10月08日 18:58 | |
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(). |
|||
| msg162455 - (view) | Author: Alexander Belopolsky (belopolsky) * (Python committer) | Date: 2012年06月07日 03:59 | |
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. |
|||
| msg162460 - (view) | Author: anatoly techtonik (techtonik) | Date: 2012年06月07日 06:13 | |
I'd say no consensus was reached due to lack of participation. My enthusiasm was killed by the issue8903 resolution. My opinion is that: datetime.time.now() is much better than: datetime.datetime.now().time() |
|||
| msg162461 - (view) | Author: anatoly techtonik (techtonik) | Date: 2012年06月07日 06:15 | |
And I certainly don't agree with you that usability changes in API are not use cases. |
|||
| msg221909 - (view) | Author: Alexander Belopolsky (belopolsky) * (Python committer) | Date: 2014年06月29日 22:25 | |
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: 1. date, time = datetime.date.today(), datetime.time.now() is attractive, but wrong. 2. time detached from date is a strange object with limited support in datetime module (no timedelta arithmetics, issue 17267; tzinfo issues; etc.) 3. No compelling use cases have been presented. |
|||
| msg221946 - (view) | Author: Raymond Hettinger (rhettinger) * (Python committer) | Date: 2014年06月30日 07:21 | |
For the reasons listed by others, marking this as closed/rejected. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:01 | admin | set | github: 53148 |
| 2014年06月30日 08:33:04 | berker.peksag | set | stage: needs patch -> resolved |
| 2014年06月30日 07:21:50 | rhettinger | set | status: open -> closed nosy: + rhettinger messages: + msg221946 resolution: rejected |
| 2014年06月29日 22:25:01 | belopolsky | set | versions:
+ Python 3.5, - Python 3.4 nosy: + lemburg messages: + msg221909 keywords: + easy |
| 2014年03月07日 15:58:23 | r.david.murray | set | nosy:
+ r.david.murray |
| 2013年06月08日 17:39:05 | ezio.melotti | set | nosy:
+ ezio.melotti versions: + Python 3.4, - Python 3.3 |
| 2013年06月05日 22:23:44 | belopolsky | set | nosy:
+ ronaldoussoren |
| 2013年06月05日 22:23:37 | belopolsky | set | status: closed -> open resolution: wont fix -> (no value) |
| 2012年06月07日 06:15:57 | techtonik | set | messages: + msg162461 |
| 2012年06月07日 06:13:07 | techtonik | set | messages: + msg162460 |
| 2012年06月07日 03:59:03 | belopolsky | set | status: open -> closed resolution: postponed -> wont fix messages: + msg162455 |
| 2010年12月01日 18:46:55 | belopolsky | set | resolution: postponed versions: + Python 3.3, - Python 3.2 |
| 2010年10月08日 18:58:42 | belopolsky | set | stage: needs patch type: enhancement versions: - Python 3.1, Python 2.7, Python 3.3 |
| 2010年10月08日 18:58:12 | belopolsky | set | messages: + msg118216 |
| 2010年06月08日 17:59:02 | belopolsky | set | messages: + msg107331 |
| 2010年06月06日 08:21:37 | techtonik | set | messages: + msg107192 |
| 2010年06月06日 08:19:03 | techtonik | set | messages: + msg107191 |
| 2010年06月06日 00:11:38 | belopolsky | set | priority: normal -> low nosy: + belopolsky messages: + msg107166 assignee: belopolsky |
| 2010年06月05日 06:36:26 | techtonik | create | |