[issue43245] Add keyword argument support to ChainMap.new_child()

2021-03-13 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43245] Add keyword argument support to ChainMap.new_child()

2021-03-13 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 9923df96413a0b480a34ec1d537b66ca0eeb0fdc by Kamil Turek in branch 
'master':
bpo-43245: Add keyword argument support to ChainMap.new_child() (GH-24788)
https://github.com/python/cpython/commit/9923df96413a0b480a34ec1d537b66ca0eeb0fdc


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43245] Add keyword argument support to ChainMap.new_child()

2021-03-08 Thread Kamil Turek


Change by Kamil Turek :


--
keywords: +patch
pull_requests: +23554
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/24788

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43245] Add keyword argument support to ChainMap.new_child()

2021-03-06 Thread Kamil Turek


Change by Kamil Turek :


--
nosy: +kamilturek

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43245] Add keyword argument support to ChainMap.new_child()

2021-02-17 Thread Raymond Hettinger


New submission from Raymond Hettinger :

This would it more convenient to extend chains for local contexts.  Currently, 
we write:

local = parent.new_child(dict(foreground='white', background='cyan'))

Instead, it would be easier to write:

local = parent.new_child(foreground='white', background='cyan')

The new code would look like this:

def new_child(self, m=None, **kwargs):
'''New ChainMap with a new map followed by all previous maps.
If no map is provided, an empty dict is used.
Keyword arguments update the map or new empty dict:
'''
if m is None:
m = kwargs
elif kwargs:
m.update(kwargs)
return self.__class__(m, *self.maps)

--
assignee: rhettinger
components: Library (Lib)
messages: 387186
nosy: rhettinger
priority: normal
severity: normal
status: open
title: Add keyword argument support to ChainMap.new_child()
type: behavior
versions: Python 3.10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com