Issue 9000: Provide parseable repr to datetime.timezone
Issue9000
Created on 2010-06-15 15:52 by belopolsky, last changed 2022-04-11 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| issue9000-proto.diff | belopolsky, 2010-07-06 15:21 | Patch against sandbox datetime.py and test_dateime.py | ||
| issue9000.diff | belopolsky, 2010-07-06 22:48 | Patch for the C code with tests | ||
| Messages (6) | |||
|---|---|---|---|
| msg107876 - (view) | Author: Alexander Belopolsky (belopolsky) * ![]() |
Date: 2010-06-15 15:52 | |
Recently added datetime.timezone class does not have a custom repr, so one gets >>> timezone.utc <datetime.timezone object at 0x100681ef0> instead of parseable datetime.timezone(datetime.timedelta(0)) This is inconsistent with the way other classes in datetime module behave. |
|||
| msg107877 - (view) | Author: Alexander Belopolsky (belopolsky) * ![]() |
Date: 2010-06-15 15:54 | |
Merged issue5094 nosy list. |
|||
| msg109397 - (view) | Author: Alexander Belopolsky (belopolsky) * ![]() |
Date: 2010-07-06 15:21 | |
I am attaching a python prototype. I am following the convention in place for the other datetime classes of prepending the repr with 'datetime.'. This may not be ideal, but better than to introduce an inconsistency. The only question I think is worth considering is the representation of timezone.utc. I would like to have repr(timezone(timedelta(0))) == 'datetime.timezone.utc' even though currently timezone(timedelta(0)) and timezone.utc are different but equal objects. This is going to change, however. See issue9051. [1] http://bugs.python.org/issue5094#msg106411 |
|||
| msg109436 - (view) | Author: Alexander Belopolsky (belopolsky) * ![]() |
Date: 2010-07-06 22:42 | |
Attaching a C patch. |
|||
| msg109438 - (view) | Author: Alexander Belopolsky (belopolsky) * ![]() |
Date: 2010-07-06 22:48 | |
Replacing the patch. The previously attached patch reverted issue9051 a bit too aggressively. |
|||
| msg109443 - (view) | Author: Alexander Belopolsky (belopolsky) * ![]() |
Date: 2010-07-06 23:21 | |
Committed in r82617. Python version committed to sandbox in r82616. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:57:02 | admin | set | github: 53246 |
| 2010-07-10 21:34:51 | eric.araujo | set | resolution: accepted -> fixed |
| 2010-07-06 23:21:34 | belopolsky | set | status: open -> closed messages:
+ msg109443 |
| 2010-07-06 22:49:02 | belopolsky | set | files: - issue9000.diff |
| 2010-07-06 22:48:55 | belopolsky | set | files:
+ issue9000.diff messages: + msg109438 |
| 2010-07-06 22:42:01 | belopolsky | set | files:
+ issue9000.diff resolution: accepted messages: + msg109436 stage: test needed -> commit review |
| 2010-07-06 15:21:38 | belopolsky | set | files:
+ issue9000-proto.diff keywords: + patch messages: + msg109397 |
| 2010-06-16 04:33:02 | brett.cannon | set | nosy:
- brett.cannon |
| 2010-06-15 15:54:32 | belopolsky | set | nosy:
+ tim.peters, doerwalter, brett.cannon, mark.dickinson, ggenellina, pitrou, techtonik, ajaksu2, kawai, ezio.melotti, eric.araujo, r.david.murray, rafe, daniel.urban, l0nwlf, akira messages: + msg107877 |
| 2010-06-15 15:53:22 | belopolsky | set | dependencies:
+ datetime lacks concrete tzinfo implementation for UTC versions: + Python 3.2 |
| 2010-06-15 15:52:46 | belopolsky | create | |
