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.

classification
Title: unpractical printing of datetimes by the interpreter
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.7
process
Status: closed Resolution: third party
Dependencies: Superseder:
Assigned To: Nosy List: belopolsky, jean.rblt, p-ganssle, serhiy.storchaka
Priority: normal Keywords:

Created on 2020-09-09 09:48 by jean.rblt, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (2)
msg376626 - (view) Author: J Rt (jean.rblt) Date: 2020-09-09 09:48
I think the way datetimes get printed by the interpreter is a bit unpractical. For example:

datetime.datetime(2020, 9, 9, 8, 0, tzinfo=<UTC>) 

The reason for the inpracticality is that this cannot be put right into python back:

>>>datetime.datetime(2020, 9, 9, 8, 0, tzinfo=<UTC>)                                             
  File "<ipython-input-77-304f010bd0d1>", line 1
    datetime.datetime(2020, 9, 9, 8, 0, tzinfo=<UTC>)
                                               ^
SyntaxError: invalid syntax

Would there be a way to make the output printed directly usable again in the interpreter? Printing datetime.datetime(2020, 9, 9, 8, 0, tzinfo=pytz.utc) for example, or something like that?
msg376629 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-09-09 11:03
The UTC timezone implementation in the stdlib works well:

>>> import datetime
>>> datetime.datetime(2020, 9, 9, 8, 0, tzinfo=datetime.timezone.utc)
datetime.datetime(2020, 9, 9, 8, 0, tzinfo=datetime.timezone.utc)

I guess you use a third-part implementation of the UTC timezone. In such case please report your issue to this implementation.
History
Date User Action Args
2022-04-11 14:59:35adminsetgithub: 85916
2020-09-09 11:03:39serhiy.storchakasetstatus: open -> closed

nosy: + serhiy.storchaka
messages: + msg376629

resolution: third party
stage: resolved
2020-09-09 09:52:04xtreaksetnosy: + belopolsky, p-ganssle
2020-09-09 09:48:57jean.rbltcreate