So this would be a way to (1) rewrite f-strings as regexes; (2) with named capture groups assigned to locals() instead of re.Match.groupdict()?
Would it default to `r'(.*?)'` ? https://docs.python.org/3/library/re.html#re.Match.groupdict https://pypi.org/project/regex/ On Thu, Sep 17, 2020, 12:54 PM Chris Angelico <ros...@gmail.com> wrote: > On Fri, Sep 18, 2020 at 2:13 AM Alexis Masson <a.masson...@ntymail.com> > wrote: > > This, in addition with locals().update(_), feels much better to me. > Furthermore, it would allow other string-like classes, such as bytes or > bytearray, to use that feature. > > > > But locals().update() isn't a supported operation, except in the > situation where locals() is globals(). So what you're suggesting would > work fine in the REPL but not in any production usage. > > ChrisA > _______________________________________________ > 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/M3JEIJ5EP7IVGRGNDZQVF4YKQ5PBGVJ3/ > Code of Conduct: http://python.org/psf/codeofconduct/ >
_______________________________________________ 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/IHGVHYZCXCFGZOZHC6FXLPCZD3VHDSIJ/ Code of Conduct: http://python.org/psf/codeofconduct/