> On 23 Feb 2021, at 18:08, Stéfane Fermigier <s...@fermigier.com> wrote: > > > Both '%' and .format() support both positional and named arguments. > > There are probably a few use cases for .format() (vs. f-strings) but overall > I don't believe there is much reasons left to prefer %.
I18n you can translate a f string. Barry > > Note that the existence, and popularity, of tools like flynt and pyupgrade > (that convert % and .format() directives to f-strings automatically) supports > this affirmation. > > I found the 'un-fstring' project on pypi that does the reverse, but it's use > case, as advertised in the README, is clear: "Sometimes, unfortunately, you > need to write code that is compatible with Python 3.5"... > > S. > > >> On Tue, Feb 23, 2021 at 6:50 PM Chris Angelico <ros...@gmail.com> wrote: >> On Wed, Feb 24, 2021 at 4:13 AM Richard Damon <rich...@damon-family.org> >> wrote: >> > As far as between % or .format(), I think the documentation is fairly >> > clear that the % method is 'old' and if not 'formally' deprecated, is no >> > longer considered the 'obvious' way to do it (even if some people will >> > still do it that way for the simplest cases). >> >> Not really - both forms have their places. You use .format() when you >> need to be able to reorder arguments, you use percent formatting when >> you want a compact and simple notation. It's like how we have both >> string methods and regular expressions - neither one deprecates the >> other. >> >> 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/UEZIQ56UYPDWQE3UU5BP72ADRKM2ZSNB/ >> Code of Conduct: http://python.org/psf/codeofconduct/ > > > -- > Stefane Fermigier - http://fermigier.com/ - http://twitter.com/sfermigier - > http://linkedin.com/in/sfermigier > Founder & CEO, Abilian - Enterprise Social Software - http://www.abilian.com/ > Chairman, National Council for Free & Open Source Software (CNLL) - > http://cnll.fr/ > Founder & Organiser, PyParis & PyData Paris - http://pyparis.org/ & > http://pydata.fr/ > _______________________________________________ > 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/TTOMZH2L27DU3LCC7PSKNFQL2NA7KEKH/ > 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/G32LOYMNBMFQX5RNL4HYFT5IEGZGWQ3B/ Code of Conduct: http://python.org/psf/codeofconduct/