[Python-ideas] Have a "j" format option for lists

Facundo Batista facundobatista at gmail.com
Thu May 10 12:28:49 EDT 2018


2018-05-10 10:34 GMT-03:00 Chris Angelico <rosuav at 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?

Thanks!

-- 
.    Facundo

Blog: http://www.taniquetil.com.ar/plog/
PyAr: http://www.python.org/ar/
Twitter: @facundobatista


More information about the Python-ideas mailing list