Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #102101

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

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Subject Re: Re[2]: .format won't display my value with 2 decimal places: Why?
Date Tue, 26 Jan 2016 04:36:56 +1100
Lines 17
Message-ID <mailman.226.1453743419.15297.python-list@python.org> (permalink)
References <CALwzidmWXJdFq1DbW3_zTGVeDbxW0W2BeLcyc20PXCAiGFr-1A@mail.gmail.com> <emfb5e9d53-d700-456e-af54-ddd3d16ce379@andromeda> <CALwzid=Zfs+OpJOt6er7m6dv+g_iFR7m85FXLo+YTCygR=dZLQ@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de m3H1+tQN3DAa30WYEeGzNw0YFqf2uIQxHeH00yNWW3hw==
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'received:209.85.223': 0.03; 'elements.': 0.05; 'trailing': 0.07; 'cc:addr:python-list': 0.09; 'subject:Why': 0.09; 'jan': 0.11; '2016': 0.16; 'cc:name:python': 0.16; 'elements,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; "wouldn't": 0.16; 'string': 0.17; 'element': 0.18; 'skip:{ 20': 0.18; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'suggested': 0.20; 'am,': 0.23; 'elements': 0.23; 'ignored.': 0.23; 'header:In-Reply-To:1': 0.24; 'message-id:@mail.gmail.com': 0.27; 'third': 0.33; 'point,': 0.33; 'tue,': 0.34; 'received:google.com': 0.35; 'fail': 0.35; 'should': 0.36; 'there': 0.36; 'received:209.85': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'really': 0.37; 'expect': 0.37; 'received:209': 0.38; 'why': 0.39; 'subject:[': 0.39; 'format': 0.39; 'subject:with': 0.40; 'still': 0.40; '26,': 0.72; 'chrisa': 0.84; 'extras': 0.84; 'subject:value': 0.84; 'to:none': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=nfOQ966e70EgkCXcEakUZ+YsIbSMl1ILkYHBVAKhhfQ=; b=VCf+sP1ZXdBPCQb9I+NA/egIsXXW8QCnavjvSWaMjJ4zPbxSqB6DC7vEjv95zWIbAJ fLwk9d3NnJmgDT0Bgp6h918voCuV/rjXdUV5LfdGM8ZY35PKZQFE4xO0VaIVJraGjusy 4YZVnT61AKegCluvckguWCESM7cACjYliNAZ1wat/bA60JjS93qZQM4WnETQGgi8MGIA iWzq8ACRTKy6p2GiPV/8ba7/sO0Vz+XDKYf4Wr0Ss/LBI7n0b+msEYMI6ceF+QnHEaWt CV8Wc/acQFCIsnMWdo6XksxO66evmiENQi1olj2l6PmSC8mSwQKeqj8V36dUFPHFDT02 iKdw==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:cc:content-type; bh=nfOQ966e70EgkCXcEakUZ+YsIbSMl1ILkYHBVAKhhfQ=; b=SE79dgUaW+4u8inUCOqBxiFMj86gISYrORLuzlSa37zymOLG4dYmW53tUKuZF1i0QS jHaSjJpRYh8P5Rl3KmUwirWth+M4HVjP6Dy2dA3eO40+GbXwwET/FL47x1A+lMLCOJKk XU/5R+Cys4CcprHa+PgaKAtohq3LiFvuDFTNa9vAzSx16PZ3UDr7YgLTbRjuFxznTGta NaXMDwi3xOo5iG7lOkhw/0Y4v1mNAxmbpdYD8y9t9J0OEzVl07GVpZ6OTQfxxzQBfGRv fqEI8n5CbJCc0CPCtbEgQ/MoZM8zAqZrEAnsKsdYGFdHVbdcu9QYhCB+65EKOfUyiK3E OJhg==
X-Gm-Message-State AG10YOSP56OkbwLUnLh+IX14GoYhWsiwQJQtUDV4QXTZar9ZKX1eCdOjpgskruogXAe+PxOsDvtNRFAmp0DCpQ==
X-Received by 10.107.14.73 with SMTP id 70mr17752173ioo.31.1453743416436; Mon, 25 Jan 2016 09:36:56 -0800 (PST)
In-Reply-To <CALwzid=Zfs+OpJOt6er7m6dv+g_iFR7m85FXLo+YTCygR=dZLQ@mail.gmail.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:102101

Show key headers only | View raw


On Tue, Jan 26, 2016 at 4:31 AM, Ian Kelly <ian.g.kelly@gmail.com> 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 some_list has three elements. I wouldn't expect it to fail
> just because the middle element is unused, so why should it fail if
> there are trailing elements that are unused?

That's using selectors, so under my suggested semantics, that would
still work - as long as it has *at least* three elements, the middle
one and any extras after the third are all ignored.

ChrisA

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Re[2]: .format won't display my value with 2 decimal places: Why? Chris Angelico <rosuav@gmail.com> - 2016-01-26 04:36 +1100

csiph-web