On Jun 28, 2019, at 16:10, Chris Angelico <ros...@gmail.com> wrote: > > The %s marker would accept everything up to the next literal text. So > if you say "%s@%s", it would read up to the at sign. The second part > of the proposal would be doing that, though; the "%s" handler would > simply accept everything and return it
So, not like C scanf at all, where %s reads until white space. Also, there’s nothing like your “second part”; literals are almost useless in scanf except for things like binary protocols, because they’re not even looked at until after the previous format specifier has already been parsed. So if, say, you scan “I have 20. How many do you have?” with “I have %f. %s…”, the %f will munch the “20.”, then the literal “.” will fall). Anyway, something like my unformat or your implied design might be more useful, but I’m not sure that it would be. People have been trying to improve on scanf for 40 years, and the only things that have caught on look nothing like it (regex, or just not having a format string at all and doing something like C++ >> operator). _______________________________________________ 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/UUNEMPFQVQXUPFNJEFPPG5SIXL24BCXN/ Code of Conduct: http://python.org/psf/codeofconduct/