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.

classification
Title: 8.3. collections — Container datatypes
Type: Stage: resolved
Components: Documentation Versions: Python 3.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: rhettinger Nosy List: Sasha Kacanski, cheryl.sabella, docs@python, miss-islington, rhettinger
Priority: low Keywords: patch

Created on 2017-11-08 16:10 by Sasha Kacanski, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 11960 merged rhettinger, 2019-02-20 21:42
PR 11961 merged miss-islington, 2019-02-20 21:49
Messages (6)
msg305876 - (view) Author: Sasha Kacanski (Sasha Kacanski) Date: 2017-11-08 16:10
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
msg305903 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2017-11-08 20:41
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.
msg305905 - (view) Author: Sasha Kacanski (Sasha Kacanski) Date: 2017-11-08 20:50
Agree, and I know.

On Nov 8, 2017 3:41 PM, "Raymond Hettinger" <report@bugs.python.org> wrote:

>
> Raymond Hettinger <raymond.hettinger@gmail.com> 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 <report@bugs.python.org>
> <https://bugs.python.org/issue31982>
> _______________________________________
>
msg334307 - (view) Author: Cheryl Sabella (cheryl.sabella) * (Python committer) Date: 2019-01-24 17:10
This is a duplicate of issue 31075, which was closed as 'Not a bug'.
msg336152 - (view) Author: miss-islington (miss-islington) Date: 2019-02-20 21:49
New changeset 9b0c681e2d7e708a07e34d9c08e4424bdd4f5ebc by Miss Islington (bot) (Raymond Hettinger) in branch 'master':
bpo-31982: Improve sequence of presentation in ChainMap docs (GH-11960)
https://github.com/python/cpython/commit/9b0c681e2d7e708a07e34d9c08e4424bdd4f5ebc
msg336153 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2019-02-20 22:23
New changeset 14baf06febb9194dd76f694ec359ce94708ed861 by Raymond Hettinger (Miss Islington (bot)) in branch '3.7':
bpo-31982: Improve sequence of presentation in ChainMap docs (GH-11960) (GH-11961)
https://github.com/python/cpython/commit/14baf06febb9194dd76f694ec359ce94708ed861
History
Date User Action Args
2022-04-11 14:58:54adminsetgithub: 76163
2019-02-20 22:25:43rhettingersetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2019-02-20 22:23:38rhettingersetmessages: + msg336153
2019-02-20 21:49:59miss-islingtonsetpull_requests: + pull_request11987
2019-02-20 21:49:26miss-islingtonsetnosy: + miss-islington
messages: + msg336152
2019-02-20 21:42:18rhettingersetkeywords: + patch
stage: patch review
pull_requests: + pull_request11986
2019-01-24 17:10:00cheryl.sabellasetnosy: + cheryl.sabella
messages: + msg334307
2017-11-08 20:50:58Sasha Kacanskisetmessages: + msg305905
2017-11-08 20:41:45rhettingersetpriority: normal -> low

nosy: + rhettinger
messages: + msg305903

assignee: docs@python -> rhettinger
2017-11-08 16:10:51Sasha Kacanskicreate