Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #71478
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.010 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'syntax': 0.04; 'subject:PEP': 0.07; 'pep': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'violates': 0.09; 'finney': 0.16; 'foo,': 0.16; 'preferences,': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'true:': 0.16; 'fix': 0.17; 'looked': 0.18; 'example': 0.22; 'rules': 0.22; 'header:User- Agent:1': 0.23; 'question': 0.24; "i've": 0.25; 'define': 0.26; 'subject: : ': 0.26; 'header:X-Complaints-To:1': 0.27; 'character': 0.29; 'statement': 0.30; 'code': 0.31; 'breaking': 0.31; 'indentation': 0.31; 'writes:': 0.31; 'says': 0.33; 'running': 0.33; 'tool': 0.35; 'really': 0.36; "i'll": 0.36; 'behind': 0.37; 'level': 0.37; 'ben': 0.38; 'to:addr:python-list': 0.38; 'sure': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'space': 0.40; 'how': 0.40; 'guy': 0.60; 'break': 0.61; "you're": 0.61; 'back': 0.62; 'making': 0.63; 'answer.': 0.68; 'limit': 0.70; 'url:a': 0.72; 'observed': 0.84; 'received:125': 0.84; 'skip:s 80': 0.84 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Ben Finney <ben@benfinney.id.au> |
| Subject | Re: PEP 8 : Maximum line Length : |
| Date | Tue, 13 May 2014 22:10:11 +1000 |
| References | <CACT3xuWxJHqqV26R+3aYvpovRs7OZ6_TFynSVV-n-b+EkMmtKA@mail.gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 8bit |
| X-Gmane-NNTP-Posting-Host | jigong.madmonks.org |
| X-Public-Key-ID | 0xAC128405 |
| X-Public-Key-Fingerprint | 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405 |
| X-Public-Key-URL | http://www.benfinney.id.au/contact/bfinney-pubkey.asc |
| X-Post-From | Ben Finney <bignose+hates-spam@benfinney.id.au> |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) |
| Cancel-Lock | sha1:54wpsTHXB/Kv0di7GKCovhjaDJs= |
| 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 | <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> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.9960.1399983026.18130.python-list@python.org> (permalink) |
| Lines | 59 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1399983026 news.xs4all.nl 2845 [2001:888:2000:d::a6]:55295 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:71478 |
Show key headers only | View raw
Ganesh Pal <ganesh1pal@gmail.com> writes:
> what would be the best way to intent the below line .
You'd need to define “best” in order to get an objective answer.
So my answer will be based on my preferences, and general rules I've
observed for making code readable.
> Example 1 :
>
> p =
> Subprocess.Popen(shlex.split(cmd),stdout=subprocess.PIPE,stderr=subprocess.PIPE)
(Your example violates PEP 8 also in not having a space after the
commas. I'll fix that in my response.)
Breaking a long line after bracketing syntax is a good way to do it.
Make sure to use sntadard indentation::
Subprocess.Popen(
shlex.split(cmd), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
Alternatively, if the statement line is indented further::
Subprocess.Popen(
shlex.split(cmd),
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
> Iam running pylint and it says the above line is tool long how do I limit
> it to 79 character without violating any rules
* Break after bracketing syntax::
frobnicate(
foo, bar, baz)
* Keep all the inside-the-brackets contents at the same indentation
level (preferably 8 columns, to differentiate from a block of
statements)
if worzel:
fnoop(wibble, wobble, wubble)
frobnicate(
foo, bar, baz)
while True:
gezunk()
Here's an answer I gave on StackOverflow for this question
<URL:http://stackoverflow.com/questions/5931297/how-would-you-properly-break-this-line-to-match-pep8-rules/17246180#17246180>
(<URL:http://stackoverflow.com/a/17246180/70157>).
--
\ “If you're a cowboy and you're dragging a guy behind your |
`\ horse, I bet it would really make you mad if you looked back |
_o__) and the guy was reading a magazine.” —Jack Handey |
Ben Finney
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: PEP 8 : Maximum line Length : Ben Finney <ben@benfinney.id.au> - 2014-05-13 22:10 +1000
csiph-web