Skip to content

8.3. collections — Container datatypes #76163

Description

@catchmonster
BPO 31982
Nosy @rhettinger, @csabella, @catchmonster, @miss-islington
PRs
  • bpo-31982: Improve sequence of presentation in ChainMap docs #11960
  • [3.7] bpo-31982: Improve sequence of presentation in ChainMap docs (GH-11960) #11961
  • 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 = 'https://github.com/rhettinger'
    closed_at = <Date 2019-02-20.22:25:43.592>
    created_at = <Date 2017-11-08.16:10:51.930>
    labels = ['docs']
    title = '8.3. collections \xe2\x80\x94 Container datatypes'
    updated_at = <Date 2019-02-20.22:25:43.592>
    user = 'https://github.com/catchmonster'

    bugs.python.org fields:

    activity = <Date 2019-02-20.22:25:43.592>
    actor = 'rhettinger'
    assignee = 'rhettinger'
    closed = True
    closed_date = <Date 2019-02-20.22:25:43.592>
    closer = 'rhettinger'
    components = ['Documentation']
    creation = <Date 2017-11-08.16:10:51.930>
    creator = 'Sasha Kacanski'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 31982
    keywords = ['patch']
    message_count = 6.0
    messages = ['305876', '305903', '305905', '334307', '336152', '336153']
    nosy_count = 5.0
    nosy_names = ['rhettinger', 'docs@python', 'cheryl.sabella', 'Sasha Kacanski', 'miss-islington']
    pr_nums = ['11960', '11961']
    priority = 'low'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue31982'
    versions = ['Python 3.6']

    Activity

    1. catchmonster commented on Nov 8, 2017

      catchmonstermannequin
      MannequinAuthor

      Hi,
      In ChainMap example
      c = ChainMap() # Create root context
      d = c.new_child() # Create nested child context
      e = c.new_child() # Child of c, independent from d
      e.maps[0] # Current context dictionary -- like Python's locals()
      e.maps[-1] # Root context -- like Python's globals()
      e.parents # Enclosing context chain -- like Python's nonlocals

      d['x'] # Get first key in the chain of contexts
      d['x'] = 1 # Set value in current context

      d['x'] - will raise key does not exist error

      so simple fix is to flip last two lines...

      I know, possibly anal but look love Python and would like to help new folks to not get confused if they play with example in cPython shell...

      --best

    2. rhettinger commented on Nov 8, 2017

      @rhettinger
      Contributor

      I will flip the two because there is not downside. However, the table of wasn't intended to be a sequential example (that's why there is no data or display of result). Instead, it was just meant to be table of typing-this-does-that.

    3. catchmonster commented on Nov 8, 2017

      catchmonstermannequin
      MannequinAuthor

      Agree, and I know.

      On Nov 8, 2017 3:41 PM, "Raymond Hettinger" <[email protected]> wrote:

      Raymond Hettinger <[email protected]> added the comment:

      I will flip the two because there is not downside. However, the table of
      wasn't intended to be a sequential example (that's why there is no data or
      display of result). Instead, it was just meant to be table of
      typing-this-does-that.

      ----------
      assignee: docs@python -> rhettinger
      nosy: +rhettinger
      priority: normal -> low


      Python tracker <[email protected]>
      <https://bugs.python.org/issue31982\>


    4. csabella commented on Jan 24, 2019

      @csabella
      Contributor

      This is a duplicate of bpo-31075, which was closed as 'Not a bug'.

    5. miss-islington commented on Feb 20, 2019

      @miss-islington
      Contributor

      New changeset 9b0c681 by Miss Islington (bot) (Raymond Hettinger) in branch 'master':
      bpo-31982: Improve sequence of presentation in ChainMap docs (GH-11960)
      9b0c681

    6. rhettinger commented on Feb 20, 2019

      @rhettinger
      Contributor

      New changeset 14baf06 by Raymond Hettinger (Miss Islington (bot)) in branch '3.7':
      bpo-31982: Improve sequence of presentation in ChainMap docs (GH-11960) (GH-11961)
      14baf06

    7. 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

    Labels

    docsDocumentation in the Doc dir

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions