Skip to content

doctest: Change example under warnings section #79020

Closed

Description

@csabella
BPO 34839
Nosy @tim-one, @rhettinger, @terryjreedy, @matrixise, @JulienPalard, @csabella, @lysnikolaou, @miss-islington
PRs
  • bpo-34839: Add a 'before 3.6' in the section 'warnings' of doctest #9736
  • [3.7] bpo-34839: Add a 'before 3.6' in the section 'warnings' of doctest (GH-9736) #12793
  • 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 2018-10-20.08:46:27.747>
    created_at = <Date 2018-09-29.00:18:03.919>
    labels = ['easy', '3.8', 'type-feature', '3.7', 'docs']
    title = 'doctest: Change example under warnings section'
    updated_at = <Date 2019-04-12.06:27:31.762>
    user = 'https://github.com/csabella'

    bugs.python.org fields:

    activity = <Date 2019-04-12.06:27:31.762>
    actor = 'miss-islington'
    assignee = 'docs@python'
    closed = True
    closed_date = <Date 2018-10-20.08:46:27.747>
    closer = 'mdk'
    components = ['Documentation']
    creation = <Date 2018-09-29.00:18:03.919>
    creator = 'cheryl.sabella'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 34839
    keywords = ['easy']
    message_count = 15.0
    messages = ['326663', '327171', '327173', '327189', '327192', '327193', '327217', '327218', '327219', '327220', '327221', '327224', '327471', '328134', '340009']
    nosy_count = 9.0
    nosy_names = ['tim.peters', 'rhettinger', 'terry.reedy', 'docs@python', 'matrixise', 'mdk', 'cheryl.sabella', 'lys.nikolaou', 'miss-islington']
    pr_nums = ['9736', '12793']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue34839'
    versions = ['Python 3.7', 'Python 3.8']

    Activity

    1. csabella commented on Sep 29, 2018

      @csabella
      ContributorAuthor

      The Warnings section of the doctest documentation (https://docs.python.org/3.8/library/doctest.html#warnings) contains an example that the printing order of a dictionary is not guaranteed. Since it is now guaranteed to be insertion order, perhaps the example should be changed.

    2. added
      docs
      type-feature
      on Sep 29, 2018
    3. terryjreedy commented on Oct 5, 2018

      @terryjreedy
      Member

      To me, the question is whether to delete the dict example, or qualify it with "Before 3.7 (or 3.6 for CPython)" but leave the illustration of workarounds. Raymond, what do you thing?

    4. tim-one commented on Oct 5, 2018

      @tim-one
      Member

      Add a comment along the lines you (Terry) suggested. Some people need to write doctests that run under many versions of Python, so the info is still supremely relevant to them.

    5. csabella commented on Oct 5, 2018

      @csabella
      ContributorAuthor

      Thanks for the discussion. I'll mark this as 'easy' for a first-time contribution.

    6. terryjreedy commented on Oct 5, 2018

      @terryjreedy
      Member

      I am posting this on core-mentorship. If you want to do this, post here and submit the PR within a day. I will do the merge is no-one else does.

    7. lysnikolaou commented on Oct 5, 2018

      @lysnikolaou
      Member

      I would be happy to change this. I will submit a PR ASAP.

    8. matrixise commented on Oct 6, 2018

      @matrixise
      Member

      Hi Terry,

      You say we need to keep this illustration with a section 'before 3.6' but in think it's a bad thing.

      1. when you read a documentation, you just copy the example, and sometimes you don't read the requirements.
      2. why do we need to keep an illustration for a previous version of Python? since >= 3.6 we keep the order (officially in 3.7), in this case, the example is useless, because you read the documentation of >= 3.7.

      I would prefer to remove this example for >= 3.6 and keep the illustration for the previous version.

      I am really interested by the feedback of Tim, Cheryl and Raymond.

    9. rhettinger commented on Oct 6, 2018

      @rhettinger
      Contributor

      Raymond, what do you think?

      I concur with Tim.

    10. rhettinger commented on Oct 6, 2018

      @rhettinger
      Contributor

      FWIW, set objects are still unordered, so they too require sorting for a reproducible doctest.

    11. matrixise commented on Oct 6, 2018

      @matrixise
      Member

      Hi Raymond,

      Ok, if you agree with Tim, I just created a PR.

      Have a nice day,

    12. tim-one commented on Oct 6, 2018

      @tim-one
      Member

      Stephane, it's not deep. People who need to write doctests that work across N versions of Python shouldn't need to read N versions of the documentation. This is hardly unique to doctest. We routinely add "Changed in version m.n" blurbs all over the place.

      Ways that were _necessary_ for robust dict testing continue to work fine in 3.6 and 3.7, so it doesn't harm anything if people mindlessly copy an example that _could_ be spelled some other way under 3.6+. It's not like there's even anything slightly obscure about, e.g.,

      >>> foo() == {"Hermione": "hippogryph", "Harry": "broomstick"}
      True
    13. matrixise commented on Oct 6, 2018

      @matrixise
      Member

      Tim,

      I understand. It's just my experience, I have seen a lot of new comers (in my python trainings), they just copy the examples and don't read the total explanation. sometimes, because english is not their native language and in this case, they try to find an example, copy/paste and run it and when there is an exception, they will try to read the doc.

      so, I have pushed a PR, I just changed sentences, I am waiting for your suggestions.

      Thank you for your explanation.

    14. matrixise commented on Oct 10, 2018

      @matrixise
      Member

      Hi Raymond and Tim,

      I just updated the PR with your recommendations.

      Have a nice day,

    15. JulienPalard commented on Oct 20, 2018

      @JulienPalard
      Member

      New changeset 0522fd8 by Julien Palard (Stéphane Wirtel) in branch 'master':
      bpo-34839: Add a 'before 3.6' in the section 'warnings' of doctest (GH-9736)
      0522fd8

    16. miss-islington commented on Apr 12, 2019

      @miss-islington
      Contributor

      New changeset a910c2c by Miss Islington (bot) in branch '3.7':
      bpo-34839: Add a 'before 3.6' in the section 'warnings' of doctest (GH-9736)
      a910c2c

    17. transferred this issue fromon Apr 10, 2022
    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

      3.7 (EOL)3.8 (EOL)docseasytype-feature

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions