Re[2]: .format won't display my value with 2 decimal places: Why?

2016-01-25 Thread MRAB
On 2016-01-25 16:51:36, "Ian Kelly" wrote: On Sun, Jan 24, 2016 at 2:20 PM, MRAB wrote: The format method, on the other hand, belongs to the format string it's attached to. In this example: 'The new price is {}' .format(newPrice,

Re: Re[2]: .format won't display my value with 2 decimal places: Why?

2016-01-25 Thread Chris Angelico
On Tue, Jan 26, 2016 at 4:31 AM, Ian Kelly wrote: >> Do you really want to insist that the format string always used _all_ of the >> arguments? > > Good point, that makes sense. For example, I would expect this to work: > > '{0} {2}'.format(*some_list) > > as long as

Re: Re[2]: .format won't display my value with 2 decimal places: Why?

2016-01-25 Thread Ian Kelly
On Mon, Jan 25, 2016 at 10:19 AM, MRAB wrote: > > > On 2016-01-25 16:51:36, "Ian Kelly" wrote: > >> >> Why doesn't str.format raise an exception when passed extra positional >> arguments? >> > That format string uses auto-numbering, and it's