Maybe I'm missing something, but why do you need the SimpleNamespace at all? 
Why not make your own mapping as in

    class StringMapper:
        ...
        def __getitem__(self, s):
            # Whatever arbitrary behavior you want
            # Process suffixes, etc here, for example:
            if s.endswith(".lc"):
                return self.wrapped[s.removesuffix(".lc")].lower()
            return self.wrapped[s]
 
   format_string.format_map(StringMapper(whatever))


Maybe then the data can just be data and this wrapper can handle all the 
formatting conversions.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/RDS4KL7SUAP4AAA2XVBZTM5SZE4NUU46/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to