-1 on idea. Far too many edge cases that can't be handled... Or absurd complexity added to format mini-language if it tries to handle them (and still fails).
On Thu, May 10, 2018, 3:57 PM Eric V. Smith <e...@trueblade.com> wrote: > On 5/10/18 12:28 PM, Facundo Batista wrote: > > 2018-05-10 10:34 GMT-03:00 Chris Angelico <ros...@gmail.com>: > > > >>> > >>> Ideally, it will handle *any* iterable. > >> > >> If it's to handle arbitrary iterables, it can't be the normal style of > >> "take this string, pass it to the object's __format__ method, and let > >> it interpret it". That's why I suggested a bang notation instead. We > >> have some already: > > > > Yes, I think it fits better, as it's not just a formatting, it's more > > an "operation"... > > > >> A "!j" flag > >> could take an iterable, format each element using the given format, > >> and then join them. The letter "j" makes good sense then, as it > > > > Where would you indicate the separator if we use the bang notation? > > You would have to wedge it in before the colon. Something like: > > f'{lst!j, :20}' > > But then you couldn't have a colon in the separator. And this would be > our first conversion character to be more than a single character. > > I'm opposed to this proposal. Just call str.join(), or write a helper > function or class (depending on what you're trying to do). It's not > worth complicating what's already a complicated topic. > > Eric > _______________________________________________ > Python-ideas mailing list > Python-ideas@python.org > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.org/psf/codeofconduct/ >
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/