Skip to content

Don't use east/west of UTC in date/time documentation #53551

Closed

Description

@abalkin
BPO 9305
Nosy @tim-one, @freddrake, @abalkin, @vadmium, @crwilcox, @pganssle, @csabella, @ravipudi, @slateny
PRs
  • bpo-9305: Remove east/west references from datetime #31697
  • Dependencies
  • bpo-7229: Manual entry for time.daylight can be misleading
  • bpo-8810: TZ offset description is unclear in docs
  • Files
  • datetime_doc_remove_east_west.diff
  • datetime_doc_remove_east_west_2.diff
  • 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 = None
    created_at = <Date 2010-07-19.16:21:43.892>
    labels = ['easy', 'type-feature', 'docs']
    title = "Don't use east/west of UTC in date/time documentation"
    updated_at = <Date 2022-03-05.16:55:35.124>
    user = 'https://github.com/abalkin'

    bugs.python.org fields:

    activity = <Date 2022-03-05.16:55:35.124>
    actor = 'slateny'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Documentation']
    creation = <Date 2010-07-19.16:21:43.892>
    creator = 'belopolsky'
    dependencies = ['7229', '8810']
    files = ['19694', '19709']
    hgrepos = []
    issue_num = 9305
    keywords = ['patch', 'easy']
    message_count = 24.0
    messages = ['110774', '110905', '110910', '110911', '110912', '110916', '110917', '110918', '110919', '110926', '121726', '121727', '121728', '121745', '121751', '121765', '126020', '185565', '221916', '257935', '304934', '332985', '333045', '361715']
    nosy_count = 15.0
    nosy_names = ['tim.peters', 'fdrake', 'belopolsky', 'techtonik', 'rbp', 'docs@python', 'henriquebastos', 'Rodolpho.Eckhardt', 'martin.panter', 'crwilcox', 'p-ganssle', 'cheryl.sabella', 'Ajay Mahato', 'ravipudi', 'slateny']
    pr_nums = ['31697']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue9305'
    versions = ['Python 3.2']

    Activity

    1. abalkin commented on Jul 19, 2010

      @abalkin
      MemberAuthor

      I am opening this to supersede bpo-7229. See discussion following msg107148.

      In many places offsets representing the difference between local time and UTC are described as minutes or seconds east or west of UTC. This is not correct because UTC is not a place and minutes and seconds don't measure distance in this context. Replacing UTC with the Prime Meridian will not fix that because some regions in the western hemisphere use positive offsets from UTC. or example, Madrid is at 3° 42' West, but uses Central European Time which is UTC+1.

      I believe geographical references in the python documentation are irrelevant. What users are interested in is how to convert local time to UTC and UTC to local time rather than what is the sign of time.timezone in Madrid.

      I suggest the following wording for time.timezone description:

      time.timezone: The number of seconds one must add to the local time to arrive at UTC.

      Similarly, tzinfo.utcoffset() can be defined as "Returns timedelta one must add to UTC to arrive at local time."

    2. added
      docsDocumentation in the Doc dir
      type-featureA feature request or enhancement
      on Jul 19, 2010
    3. techtonik commented on Jul 20, 2010

      techtonikmannequin
      Mannequin

      On Mon, Jul 19, 2010 at 7:21 PM, Alexander Belopolsky
      <report@bugs.python.org> wrote:

      I suggest the following wording for time.timezone description:

      time.timezone: The number of seconds one must add to the local time to arrive at UTC.

      Makes sense. I can't see any other real explanation for -7200 value if
      I am in +2 UTC timezone.

      Similarly, tzinfo.utcoffset() can be defined as "Returns timedelta one must add to UTC to arrive at local time."

      I believe the correct convention is "Return timedelta...". Another
      concern - if UTC is 0 reference point then there is no reason to add
      something to it - you just can say - "Return timedelta equal to local
      UTC offset."

    4. abalkin commented on Jul 20, 2010

      @abalkin
      MemberAuthor

      On Tue, Jul 20, 2010 at 10:46 AM, anatoly techtonik
      <report@bugs.python.org> wrote:

      .. Another
      concern - if UTC is 0 reference point then there is no reason to add
      something to it - you just can say - "Return timedelta equal to local
      UTC offset."

      No, UTC is not a 0 reference point, it is a time scale. UTC offset is
      the value that is used to translate between time expressed in UTC and
      local time. To make an analogy, expressing time in UTC is like
      expressing temperature in Kelvin scale. You need to subtract 273 from
      the value in ºK to arrive at the value in ºC.

      Documenting utcoffset() as "Return timedelta equal to local UTC
      offset." is almost circular. It does not explain whether it has to be
      added or subtracted from UTC to arrive at local time.

    5. tim-one commented on Jul 20, 2010

      @tim-one
      Member

      FYI, I like the change. As I recall it, the current wording was just to avoid saying "ahead of UTC" or "behind UTC" (which was the original wording). Technically pure or not, I never saw anyone get truly confused by "East of UTC" or "West of UTC", but I fully that what people really want to know is what to do with the thing (add or subtract it).

    6. freddrake commented on Jul 20, 2010

      @freddrake
      Member

      On Tue, Jul 20, 2010 at 10:46 AM, anatoly techtonik <techtonik@gmail.com> wrote:

      I believe the correct convention is "Return timedelta...".

      This is handled inconsistently in the documentation; I'm hoping the
      current maintainers reinforce the "Returns ..." structure. The
      documentation is descriptive, not an external specification.

        -Fred

    7. techtonik commented on Jul 20, 2010

      techtonikmannequin
      Mannequin

      Documenting utcoffset() as "Return timedelta equal to local UTC
      offset." is almost circular.  It does not explain whether it has to be
      added or subtracted from UTC to arrive at local time.

      Ok. Sold.

      > I believe the correct convention is "Return timedelta...".

      This is handled inconsistently in the documentation; I'm hoping the
      current maintainers reinforce the "Returns ..." structure.  The
      documentation is descriptive, not an external specification.

      http://www.python.org/dev/peps/pep-0257/#one-line-docstrings

      I've took the convention from here. I thought docs are generated from
      docstrings.

    8. freddrake commented on Jul 20, 2010

      @freddrake
      Member

      On Tue, Jul 20, 2010 at 12:08 PM, anatoly techtonik
      <report@bugs.python.org> wrote:

      I've took the convention from here. I thought docs are generated from
      docstrings.

      They're not, but I don't think that really matters.

      Older documentation used the imperative form consistently, but that's
      shifted over time. (I, at least, think that's a good thing.)

      I don't think it really matters with regard to this issue.

    9. abalkin commented on Jul 20, 2010

      @abalkin
      MemberAuthor

      On Tue, Jul 20, 2010 at 11:39 AM, Tim Peters <report@bugs.python.org> wrote:

      ..  As I recall it, the current wording was just to avoid saying "ahead of UTC" or "behind UTC" (which was the original wording).

      Interesting. I actually like the original wording better. For me,
      "my watch is 6 hours behind UTC" makes it clear that when the Big Ben
      clock shows tea time (18:00), my watch displays noon (17:00 - 6:00 =
      12:00.)

      I wonder if east/west is somehow more natural for native speakers of
      English. I would really like to hear more from the international
      audience. When it comes to measuring time there are many interesting
      traditions that don't translate well between nations. For example,
      I've heard that in the Far East, the future is considered to be behind
      because you can see the past but you cannot see the future. If this
      is the notion that you are used to, time being ahead or behind can be
      truly confusing.

    10. abalkin commented on Jul 20, 2010

      @abalkin
      MemberAuthor

      On Tue, Jul 20, 2010 at 12:14 PM, Alexander Belopolsky
      <report@bugs.python.org> wrote:
      ..

      Interesting.  I actually like the original wording better.  For me,
      "my watch is 6 hours behind UTC" makes it clear that when the Big Ben
      clock shows tea time (18:00), my watch displays noon (17:00 - 6:00 =
      12:00.)

      I was too excited to add Alice in Wonderland humor to my post that did
      not get the math right. :-)

      The above should read 18:00 - 6:00 = 12:00, of course. Or was it five
      o'clock after all?

    11. abalkin commented on Jul 20, 2010

      @abalkin
      MemberAuthor

      On Tue, Jul 20, 2010 at 12:08 PM, anatoly techtonik
      <report@bugs.python.org> wrote:
      ..

      Ok. Sold.

      Good. All we need now is just a patch. :-)

    12. henriquebastos commented on Nov 20, 2010

      henriquebastosmannequin
      Mannequin

      Here goes a patch to replace east/west references on datetime documentation.

      As spoken with fdrake we think the datetime documentation could be improved extracting the timezone subclassing details to specific section. We'll be filling a new issue for that patch.

    13. 4 remaining items

    14. abalkin commented on Nov 20, 2010

      @abalkin
      MemberAuthor

      On the second reading, I have a few issues with the patch.

      1. Please run makepatcheck. There are whitespace issues in datetime.rst.
      2. In docstrings, you remove the information about the sign. I would not mind leaving docstrings the way they are. Otherwise, please add a short sentence explaining the sign of utcoffset and dst.
      3. "This represents the offset in minutes that must be added to the local time zone to follow DST rules." This unclear. DST offset is added to the "standard time", not "local time zone". (I am not sure if "standard time" is defined in the manual, though.) Also, "in minutes" is not necessary - timedelta carries the units. You can add that only offsets that are multiples of a minute are supported.
    15. henriquebastos commented on Nov 20, 2010

      henriquebastosmannequin
      Mannequin

      To clarify:

      1. "we" means henriquebastos, rbp, Rodolpho.Eckhardt.

      2. Mentioning fdrake I was trying to say that we followed his suggestion to only submit the specific changes on this patch, leaving further documentation changes to another issue.

      Sorry about any inconvenience.

    16. rbp commented on Nov 20, 2010

      rbpmannequin
      Mannequin
      1. Done (it's on the patch I'm uploading). Sorry.

      2. Ok, we've rewritten that sentence. As Henrique mentioned, we're working on a larger patch to make datetime documentation clearer, and we can include a definition of "standard time" there.

      3. I assume you're talking about sentences like "(negative for west of UTC)". We removed that wording because it inevitably leads to associating UTC with a geographical reference. Even if we disregard that, it's not true that "utcoffset is negative west of UTC", since it will we zero for for UTC-1 (and even +1 for places physically "west of UTC" but at timezone UTC+0) when DST is effective.

      It seems that any sentence we add to that effect will be simply restating the definitions of UTC, timezones and DST (and their mathematical relationships). That is, "utcoffset will be negative when dt.tzinfo + dst() is negative".

      Perhaps we could include a more detailed discusion about the sign of utcoffset() on the larger doc patch I've mentioned? Or do you have any suggestions?

    17. abalkin commented on Jan 11, 2011

      @abalkin
      MemberAuthor

      I've noticed that the time module docstring handles this issue rather nicely:

      >>> help('time')
      ...
          timezone -- difference in seconds between UTC and local standard time
          altzone -- difference in  seconds between UTC and local DST time

      We can use similar language for utcoffset(): "difference between local time and UTC expressed as a timedelta".

    18. BreamoreBoy commented on Mar 30, 2013

      BreamoreBoymannequin
      Mannequin

      Well, we have a patch and it's been discussed here and on bpo-7229, so can we take this forward?

    19. abalkin commented on Jun 29, 2014

      @abalkin
      MemberAuthor

      This seems to be touching the same areas as bpo-9305.

    20. removed their assignment
      on Jun 29, 2014
    21. vadmium commented on Jan 10, 2016

      @vadmium
      Member

      Assuming you meant bpo-8810, yes these patches would collide with each other. I am yet to look at the patches, but I gess they should be merged.

    22. csabella commented on Oct 24, 2017

      @csabella
      Contributor

      Would one of the original authors of the patches like to create a GitHub pull request for this issue?

    23. AjayMahato commented on Jan 4, 2019

      AjayMahatomannequin
      Mannequin

      I would like to work on this issue. Please assign this to me.

    24. AjayMahato commented on Jan 5, 2019

      AjayMahatomannequin
      Mannequin

      I am taking up this issue.

    25. crwilcox commented on Feb 10, 2020

      crwilcoxmannequin
      Mannequin

      Are you still working on this Ajay Mahato?

    26. transferred this issue fromon Apr 10, 2022
    27. slateny commented on May 12, 2022

      @slateny
      Contributor

      Closed per comment

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      docsDocumentation in the Doc direasytype-featureA feature request or enhancement

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions