On 9 May 2018 at 14:49, Eric V. Smith <e...@trueblade.com> wrote: > On 5/9/18 9:28 AM, Chris Angelico wrote: >> On Wed, May 9, 2018 at 11:06 PM, Steven D'Aprano <st...@pearwood.info> >> wrote: >> >>> - do you truly mean lists *only*, or is any iterable acceptible? >> >> With the letter being "j" and the semantics being lifted from >> str.join(), I would guess the latter. > > Since '{:spec}'.format(obj) basically becomes obj.__format__('spec'), this > would have to be implemented on a concrete type (in the above example, > list).
[...] > I would object to changing the format machinery. Any format spec should be > interpreted by some object's __format__ method. Agreed. In theory this is a nice idea, but the way formatting is implemented (and the fact that join is a method on strings taking an arbitrary iterable as an argument) means that it's a bad fit for the format mini-language. I don't think the improved convenience is sufficient to warrant the change that would be required in practice. (But if someone found a way to make it work *without* changes to the underlying format machinery, that would be a different matter...) Paul _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/