Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #50257
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <xfq.free@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.003 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'newbie': 0.05; '"""': 0.07; 'subject:PEP': 0.07; 'pep': 0.09; 'subject:question': 0.10; 'cc:addr:python-list': 0.11; 'python': 0.11; 'bug': 0.12; "'a',": 0.16; "'b',": 0.16; "'c',": 0.16; "'d',": 0.16; "'e',": 0.16; '...,': 0.16; 'and)': 0.16; 'constructs': 0.16; 'enough.': 0.16; 'item:': 0.16; 'there...': 0.16; 'wording': 0.16; 'wrote:': 0.18; 'trying': 0.19; '(but': 0.19; 'cc:addr:python.org': 0.22; 'mon,': 0.24; 'cc:2**0': 0.24; 'second': 0.26; 'header:In-Reply-To:1': 0.27; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'code': 0.31; 'indentation': 0.31; 'file': 0.32; 'could': 0.34; 'agree': 0.35; 'skip:s 30': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'consistent': 0.36; 'in:': 0.36; 'done': 0.36; 'massive': 0.38; 'issue': 0.38; 'list,': 0.38; 'pm,': 0.38; 'wonderful': 0.60; 'skip:* 10': 0.61; 'july': 0.63; 'places': 0.64; 'more': 0.64; 'to:addr:gmail.com': 0.65; 'jul': 0.74; 'grow': 0.77; '|the': 0.84; '2013': 0.98 |
| 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:to :cc:content-type:content-transfer-encoding; bh=YyDgxj8DzAwd908ZKvThANy7fDpI13F/lHluMF6YZIs=; b=qeb5OIMf5smAGJthImJlmeiuvooKuGC3y4rv9n/M/EeZ1IQxSN+/NAxoSIIcALImRn 0LlB6EnJwABF5NaGnqQdZlTNtQyS1eJoholEnUWwexyXdzsdKzqdODSs482FyPwkFzNG 2Ue8LHuCO0Ym9cHt4z8AxTOnnwx7AQJew8ASRQN2UZ2g/bd+9+DeCTLeY/1d3cuncKEA txjk0+6BrPaFGb6tbjM56iLZO6Xriaqr8FBXIme5qh7xGFmRwSXw37z4PRl0GDcmZW7P blzS7a7TjlSNS7doyy3okLwVpdWzLEruOINlHXGgMsIBbyChk3fgYTi3RHGm88Pdxo0B lmmQ== |
| MIME-Version | 1.0 |
| X-Received | by 10.50.129.68 with SMTP id nu4mr34389716igb.9.1373366838260; Tue, 09 Jul 2013 03:47:18 -0700 (PDT) |
| In-Reply-To | <CAN1F8qWAVdyXjXHrJqdgomvLn=EHJrkBoYoHHVZxV2TOq+JP+A@mail.gmail.com> |
| References | <CAAF+z6Hp=TZJwcDgyT94cv6Mx3Gy4gxSiZ640b9voAAjgsi6dw@mail.gmail.com> <CAN1F8qWAVdyXjXHrJqdgomvLn=EHJrkBoYoHHVZxV2TOq+JP+A@mail.gmail.com> |
| Date | Tue, 9 Jul 2013 18:47:18 +0800 |
| Subject | Re: A small question about PEP 8 |
| From | Xue Fuqiao <xfq.free@gmail.com> |
| To | Joshua Landau <joshua.landau.ws@gmail.com> |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | quoted-printable |
| X-Mailman-Approved-At | Tue, 09 Jul 2013 17:09:56 +0200 |
| Cc | python-list <python-list@python.org> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://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 | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4459.1373382597.3114.python-list@python.org> (permalink) |
| Lines | 73 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1373382597 news.xs4all.nl 16010 [2001:888:2000:d::a6]:54897 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:50257 |
Show key headers only | View raw
On Mon, Jul 8, 2013 at 6:39 PM, Joshua Landau
<joshua.landau.ws@gmail.com> wrote:
> On 8 July 2013 00:32, Xue Fuqiao <xfq.free@gmail.com> wrote:
>> I'm a Python newbie and just started reading PEP 8. PEP 8 says:
>>
>> -----------------------------------------------------------------------
>> |The closing brace/bracket/parenthesis on multi-line constructs may
>> |either line up under the last item of the list, as in:
>> |
>> |my_list = [
>> | 1, 2, 3,
>> | 4, 5, 6,
>> | ]
>> |result = some_function_that_takes_arguments(
>> | 'a', 'b', 'c',
>> | 'd', 'e', 'f',
>> | )
>> -----------------------------------------------------------------------
>>
>> I think the last item in my_list/result is 6/'f', respectively. So why
>> doesn't the bracket/paren line up _under_ the last item? ISTM the code
>> isn't consistent with the description.
> You will grow to be a wonderful pedant. What it means is that the
> indentation will match the last one. Imagine:
>
> """
> a_wonderful_set_of_things = {
> bannanas_made_of_apples,
> chocolate_covered_horns,
> doors_that_slide,
> china_but_on_the_moon,
> buffalo_with_windy_hair,
> not_missing_an_end_brace
> """ยน
>
> Now, there are several places you can put the end brace. You can (be a
> massive fool and) put it after the last item:
>
> """
> a_wonderful_set_of_things = {
> ...,
> not_missing_an_end_brace}
> """
>
> You can also (be a fool and) put it at the same *indentation*:
>
> """
> a_wonderful_set_of_things = {
> ...,
> not_missing_an_end_brace
> }
> """
>
> Or you can (be sane) and put it at no indentation:
>
> """
> a_wonderful_set_of_things = {
> ...,
> not_missing_an_end_brace
> }
> """
>
> Theoretically, there are more places you could put it (but we won't go
> there... *shudder*).
>
> The second of these is the one that PEP 8 was trying to explain. I
> agree wording could be improved, but hey. You can file a bug report at
> bugs.python.org if you care enough.
Done as issue 18412.
--
Best regards, Xue Fuqiao.
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Re: A small question about PEP 8 Xue Fuqiao <xfq.free@gmail.com> - 2013-07-09 18:47 +0800 Re: A small question about PEP 8 llanitedave <llanitedave@veawb.coop> - 2013-07-09 16:44 -0700
csiph-web