[Python-ideas] new format spec for iterable types

Mark Lawrence breamoreboy at yahoo.co.uk
Sun Sep 20 00:00:47 CEST 2015


On 09/09/2015 15:02, Eric V. Smith wrote:
> At some point, instead of complicating how format works internally, you
> should just write a function that does what you want. I realize there's
> a continuum between '{}'.format(iterable) and
> '{<really-really-complex-stuff}'.format(iterable). It's not clear where
> to draw the line. But when the solution is to bake knowledge of
> iterables into .format(), I think we've passed the point where we should
> switch to a function: '{}'.format(some_function(iterable)).
>
> In any event, If you want to play with this, I suggest you write
> some_function(iterable) that does what you want, first.
>
> Eric.
>

Something like this from Nick Coghlan 
https://code.activestate.com/recipes/577845-format_iter-easy-formatting-of-arbitrary-iterables 
???

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence



More information about the Python-ideas mailing list