New submission from Juan Javier <jjdomingu...@yahoo.com>: I think it is useful, at least for me, to add an argument, default, to [Safe,Raw]ConfigParser.get that, if present, will be returned if the methid fails to return the value.
That is, instead of rasing an exception, return default, if present. It could be done overriding the get method in SafeConfigParser, something like this: class SafeConfigParser(ConfigParser): def get(self, section, option, raw=False, vars=None, **kwds): try: return super().get(section, option, raw, vars) except Exception as exc: if "default" in kwds: return kwds["default"] raise exc ---------- components: Library (Lib) messages: 91808 nosy: jjdominguezm severity: normal status: open title: Default return value in ConfigParser type: feature request versions: Python 3.2 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue6751> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com