Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unpractical printing of datetimes by the interpreter #85916

Closed
jeanrblt mannequin opened this issue Sep 9, 2020 · 2 comments
Closed

unpractical printing of datetimes by the interpreter #85916

jeanrblt mannequin opened this issue Sep 9, 2020 · 2 comments
Labels
3.7 (EOL) end of life stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@jeanrblt
Copy link
Mannequin

jeanrblt mannequin commented Sep 9, 2020

BPO 41750
Nosy @abalkin, @serhiy-storchaka, @pganssle

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2020-09-09.11:03:39.199>
created_at = <Date 2020-09-09.09:48:57.976>
labels = ['3.7', 'type-feature', 'library']
title = 'unpractical printing of datetimes by the interpreter'
updated_at = <Date 2020-09-09.11:03:39.196>
user = 'https://bugs.python.org/jeanrblt'

bugs.python.org fields:

activity = <Date 2020-09-09.11:03:39.196>
actor = 'serhiy.storchaka'
assignee = 'none'
closed = True
closed_date = <Date 2020-09-09.11:03:39.199>
closer = 'serhiy.storchaka'
components = ['Library (Lib)']
creation = <Date 2020-09-09.09:48:57.976>
creator = 'jean.rblt'
dependencies = []
files = []
hgrepos = []
issue_num = 41750
keywords = []
message_count = 2.0
messages = ['376626', '376629']
nosy_count = 4.0
nosy_names = ['belopolsky', 'serhiy.storchaka', 'p-ganssle', 'jean.rblt']
pr_nums = []
priority = 'normal'
resolution = 'third party'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue41750'
versions = ['Python 3.7']

@jeanrblt
Copy link
Mannequin Author

jeanrblt mannequin commented Sep 9, 2020

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?

@jeanrblt jeanrblt mannequin added 3.7 (EOL) end of life stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Sep 9, 2020
@serhiy-storchaka
Copy link
Member

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.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.7 (EOL) end of life stdlib Python modules in the Lib dir type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

1 participant