<div dir="auto">-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).</div><br><div class="gmail_quote"><div dir="ltr">On Thu, May 10, 2018, 3:57 PM Eric V. Smith <<a href="mailto:eric@trueblade.com">eric@trueblade.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 5/10/18 12:28 PM, Facundo Batista wrote:<br>
> 2018-05-10 10:34 GMT-03:00 Chris Angelico <<a href="mailto:rosuav@gmail.com" target="_blank" rel="noreferrer">rosuav@gmail.com</a>>:<br>
><br>
>>><br>
>>> Ideally, it will handle *any* iterable.<br>
>><br>
>> If it's to handle arbitrary iterables, it can't be the normal style of<br>
>> "take this string, pass it to the object's __format__ method, and let<br>
>> it interpret it". That's why I suggested a bang notation instead. We<br>
>> have some already:<br>
><br>
> Yes, I think it fits better, as it's not just a formatting, it's more<br>
> an "operation"...<br>
><br>
>>  A "!j" flag<br>
>> could take an iterable, format each element using the given format,<br>
>> and then join them. The letter "j" makes good sense then, as it<br>
><br>
> Where would you indicate the separator if we use the bang notation?<br>
<br>
You would have to wedge it in before the colon. Something like:<br>
<br>
f'{lst!j, :20}'<br>
<br>
But then you couldn't have a colon in the separator. And this would be <br>
our first conversion character to be more than a single character.<br>
<br>
I'm opposed to this proposal. Just call str.join(), or write a helper <br>
function or class (depending on what you're trying to do). It's not <br>
worth complicating what's already a complicated topic.<br>
<br>
Eric<br>
_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org" target="_blank" rel="noreferrer">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer noreferrer" target="_blank">http://python.org/psf/codeofconduct/</a><br>
</blockquote></div>