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


Groups > comp.lang.python > #50139 > unrolled thread

A small question about PEP 8

Started byXue Fuqiao <xfq.free@gmail.com>
First post2013-07-08 07:32 +0800
Last post2013-07-08 11:46 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  A small question about PEP 8 Xue Fuqiao <xfq.free@gmail.com> - 2013-07-08 07:32 +0800
    Re: A small question about PEP 8 Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-07-08 11:46 +0000

#50139 — A small question about PEP 8

FromXue Fuqiao <xfq.free@gmail.com>
Date2013-07-08 07:32 +0800
SubjectA small question about PEP 8
Message-ID<mailman.4377.1373275365.3114.python-list@python.org>
Hi all,

(English is not my native language; please excuse typing errors.)

I'm a Python newbie and just started reading PEP 8.  PEP 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.

I have searched the archive of c.l.p and the web, but nothing helped.
Can anyone point me in the right direction?

--
Best regards, Xue Fuqiao.

[toc] | [next] | [standalone]


#50144

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2013-07-08 11:46 +0000
Message-ID<51daa6a2$0$9505$c3e8da3$5496439d@news.astraweb.com>
In reply to#50139
On Mon, 08 Jul 2013 07:32:01 +0800, Xue Fuqiao wrote:

> Hi all,
> 
> (English is not my native language; please excuse typing errors.)
> 
> I'm a Python newbie and just started reading PEP 8.  PEP 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.

I agree. I think it is just a mistake, and should say "under the FIRST 
item of the list".



-- 
Steven

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web