Repository navigation
8.3. collections — Container datatypes #76163
Description
Activity
catchmonster commented
on Nov 8, 2017 catchmonstermannequinMannequinAuthorMore actionsHi,
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 nonlocalsd['x'] # Get first key in the chain of contexts
d['x'] = 1 # Set value in current contextd['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
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.
catchmonster commented
on Nov 8, 2017 catchmonstermannequinMannequinAuthorMore actionsAgree, 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\>
This is a duplicate of bpo-31075, which was closed as 'Not a bug'.
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:
bugs.python.org fields: