On Fri, Sep 18, 2020 at 10:51 AM Steven D'Aprano <[email protected]> wrote: > > On Thu, Sep 17, 2020 at 11:09:35PM +1000, Chris Angelico wrote: > > > I've frequently yearned for an sscanf-like feature in Python. Usually > > I end up longhanding it with string methods, or else reaching for a > > regex, but neither of those is quite what I want. I'd prefer scanf > > notation to format strings, but either is acceptable. > > Why make this a syntactic feature when a scanf function would do? >
Because a scanf function can't assign directly. In fact, the exact same issue that led to f-strings in the first place; there's no reliable way to embed the names into the format string without a lot of redundancy. ChrisA _______________________________________________ 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/THPV7XEWCU3D2ZNLJL3UGRQC3K5RXXJG/ Code of Conduct: http://python.org/psf/codeofconduct/
