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.

Author methane
Recipients belopolsky, methane, r.david.murray
Date 2014-11-04.16:37:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1415119074.51.0.228889047772.issue22791@psf.upfronthosting.co.za>
In-reply-to
Content
This is not a spelling issue.

When people writing code converting between unixtime and datetime,
they should find `.timestamp()` and `.utcfromtimestamp()`.
But they may not awake about `.replace(tzinfo=datetime.timezone.utc)` is very important.

Since `fromtimestamp` takes `tz` as optional 2nd argument,
I feel adding 2nd `aware` option to `utcfromtimestamp` is good for symmetry.


If `datetime.datetime.utcfromtimestamp(ts).replace(tzinfo=datetime.timezone.utc)`
is clearer than `datetime.datetime.utcfromtimestamp(ts, aware=True)`,
docstring of `utcfromtimestamp` should notice about how `replace()` important:

"""
Note that it returns **naive** (tz=None) datetime.  Since naive datetime is
treated as localtime in most functions, you may have to call `.replace(tzinfo=datetime.datetime.utc)` before using it.
"""
History
Date User Action Args
2014-11-04 16:37:54methanesetrecipients: + methane, belopolsky, r.david.murray
2014-11-04 16:37:54methanesetmessageid: <1415119074.51.0.228889047772.issue22791@psf.upfronthosting.co.za>
2014-11-04 16:37:54methanelinkissue22791 messages
2014-11-04 16:37:54methanecreate