On 9/17/2020 1:28 PM, Ricky Teachey wrote:
On Thu, Sep 17, 2020 at 1:13 PM Eric V. Smith <[email protected] <mailto:[email protected]>> wrote:If someone wanted to play with this in pure Python, string.Formatter's parse() method would do all of the parsing for you.Surprisingly it is not *quite* all. The format specification mini language parser is not exposed for use. This has bummed me out more than once in the past.
Yeah, I've considered exposing this from the C code, but was never super motivated about it. I go back and forth trying to decide if it's a bad idea or not.
If you want to cheat, you can use the version at _pydecimal._parse_format_specifier. The leading underscores should give you an idea of just how unsupported this is! But as far as I know, it works.
Eric
_______________________________________________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/PLI64CRJFADVWGLH6F5YAKTKLFRGRZ3X/ Code of Conduct: http://python.org/psf/codeofconduct/
