Adeokkuw <stephanmone...@gmail.com> added the comment:
Btw: The name "read_dict" [1] as well as its docstring say exactly the opposite of what it does. It acts as a "save_dict". Maybe that can be fixed on the go ... The docstring """ [...] All types held in the dictionary are converted to strings during reading, including section names, option names and keys. [...] """ actually implies what is my proposal here: Convert arguments to str during lookup as well. ``` def __getitem__(self, key): if key != self.default_section and not self.has_section(key): raise KeyError(key) return self._proxies[key] ``` to ``` def __getitem__(self, key): try: key = str(key) except (WhateverError, IsRelevantHereError): raise KeyError(key) if key != self.default_section and not self.has_section(key): raise KeyError(key) return self._proxies[key] ``` [1] https://github.com/python/cpython/blob/3.7/Lib/configparser.py ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue35954> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com