New submission from Raymond Hettinger <raymond.hettin...@gmail.com>:
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 <rep...@bugs.python.org> <https://bugs.python.org/issue43245> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com