A small question about PEP 8

X

Xue Fuqiao

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?
 
S

Steven D'Aprano

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".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top