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


Groups > comp.lang.python > #71618

Re: PEP 8 : Maximum line Length :

Path csiph.com!usenet.pasdenom.info!news.etla.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
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; '16,': 0.03; 'see:': 0.07; 'subject:PEP': 0.07; '#include': 0.09; 'cursor': 0.09; 'debugging.': 0.09; 'feature,': 0.09; 'formatting': 0.09; 'git': 0.09; 'inserts': 0.09; 'pep': 0.09; 'cc:addr:python-list': 0.11; "wouldn't": 0.14; '"hello': 0.16; "(i'm": 0.16; 'cleans': 0.16; 'code?': 0.16; 'command,': 0.16; 'command.': 0.16; 'deletes': 0.16; 'formatting.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'readable': 0.16; 'reformatted,': 0.16; 'rules.': 0.16; 'exception': 0.16; 'wrote:': 0.18; 'else,': 0.19; '(in': 0.22; 'skip:+ 20': 0.22; 'cc:addr:python.org': 0.22; "aren't": 0.24; 'char': 0.24; "shouldn't": 0.24; 'text.': 0.24; 'file.': 0.24; 'looks': 0.24; 'cc:2**0': 0.24; 'sort': 0.25; 'source': 0.25; 'mention': 0.26; 'subject: : ': 0.26; 'second': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'matching': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'code': 0.31; 'lines': 0.31; 'that.': 0.31; 'assumes': 0.31; 'enforce': 0.31; 'file': 0.32; 'this.': 0.32; 'run': 0.32; 'text': 0.33; 'fri,': 0.33; 'plain': 0.33; 'actual': 0.34; 'screen': 0.34; 'maybe': 0.34; 'could': 0.34; 'editor': 0.35; 'no,': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'version': 0.36; 'really': 0.36; 'data,': 0.36; 'format.': 0.36; 'done': 0.36; 'doing': 0.36; 'example,': 0.37; 'turn': 0.37; 'two': 0.37; 'files': 0.38; 'that,': 0.38; 'bad': 0.39; 'support,': 0.39; 'though,': 0.39; 'sure': 0.39; 'how': 0.40; 'even': 0.60; 'tell': 0.60; 'break': 0.61; 'simply': 0.61; 'first': 0.61; 'back': 0.62; 'times': 0.62; "you'll": 0.62; 'provide': 0.64; 'more': 0.64; 'anything.': 0.68; 'music': 0.75; 'url:jpg': 0.83; '(probably': 0.84; 'end.': 0.84; 'pain': 0.84; 'url:googleusercontent': 0.84; 'absolutely': 0.87; 'thing,': 0.91; 'to:none': 0.92
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=8g0naE5FwZpa9nSNmoPN4o77Eam5PfEJ8xNFnScS+y0=; b=lMCD/TvkPX9xJW9inWLOIctYpqg5+IY3PbisETHQ+yeYbOrmYiLfVjQE4SK66Eq4iX MmFBcP60ew4UsTyQAKkV6jm7AbtaoV2bJHutPRx3rNDyWGD7S2hhcD6NUp/HDs6VJe/B Mj3vK3ilIzNU7r9XToN8IVUp0LEWhHNXtPPRnhuavqAv84DWsXwcebMSbJnS+/eZGjEE EVSYj++K+lrgMCESDj5gCYrRD2nrAsjWfyFqV/ZpbOZEy4JwVMMIAkJTg+TNYjE3uZPB wimXOE5jlOW5XEOb00RYvuesBHaicIlVCS/fzPiODXHU6vkXvpjOys/HIv/a0Fwf7PMn /y2g==
MIME-Version 1.0
X-Received by 10.52.137.174 with SMTP id qj14mr7528551vdb.32.1400166227578; Thu, 15 May 2014 08:03:47 -0700 (PDT)
In-Reply-To <87tx8r9kit.fsf@elektro.pacujo.net>
References <mailman.9945.1399965443.18130.python-list@python.org> <a3253d6a-ef89-49d5-b866-8c06a7462219@googlegroups.com> <5373f400$0$24922$e4fe514c@dreader36.news.xs4all.nl> <600f69c8-541f-4fae-a3db-4da33b776046@googlegroups.com> <mailman.10027.1400121821.18130.python-list@python.org> <ll2c3t$89v$1@news.albasani.net> <87a9ajb36d.fsf@elektro.pacujo.net> <78ac407a-c429-4a7a-93c9-5d83e0f09cbb@googlegroups.com> <8761l7b05y.fsf@elektro.pacujo.net> <mailman.10040.1400163863.18130.python-list@python.org> <87tx8r9kit.fsf@elektro.pacujo.net>
Date Fri, 16 May 2014 01:03:47 +1000
Subject Re: PEP 8 : Maximum line Length :
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
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.10045.1400166229.18130.python-list@python.org> (permalink)
Lines 71
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1400166229 news.xs4all.nl 2848 [2001:888:2000:d::a6]:48063
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:71618

Show key headers only | View raw


On Fri, May 16, 2014 at 12:36 AM, Marko Rauhamaa <marko@pacujo.net> wrote:
> You and I could have opened the same C file. Only you see:
>
>    #include <stdio.h>
>
>    int                                       +--------------------+
>    main ( int     argc,                      | My first C program |
>           char *const argv[] )               +--------------------+
>    {
>            (void) printf( "Hello world\n" );
>
>            return(0);
>    }
>
> while I see:
>
>    #include <stdio.h>
>
>    /* My first C program */
>    int main(int argc, char *const argv[]) {
>      printf("Hello world\n");
>      return 0;
>    }

Well no, for two reasons. Firstly, I think the first one looks
disgusting, so even if I had that feature, I wouldn't use it like that
:)

But more importantly: You can already do that sort of thing, and it's
a bad idea. Maybe there aren't any text editors that can do it, but
you can use source control that way. (I'm going to use git as my
example, as I don't know how it's done in hg or any other; but I'm
sure it won't be hard.) You just tell git that these files (probably
"files matching glob *.c") are to be reformatted, and provide two
commands: one that cleans a file prior to it going into source
control, and one that "smudges" it at the other end. So you could
simply write a code reformatter and register it as your smudge
command, and (in the interests of readable diffs) have some
standardized reformatter as the clean command. Voila! You now can
check out my code with your formatting.

Which brings me to the second reason for not doing this. That
clean/smudge operation *destroys information*. Once you enforce code
formatting like that, you violate PEP 8's "rule zero": sometimes, it's
better to break the rules. Sometimes, your nice code reformatting
operation will actually make the program worse... and there'll be no
way for you to get back from that.

Not to mention that any reformatting that inserts or deletes lines is
a pain for debugging. "Line 42" on your screen and "Line 42" in the
traceback won't be the same thing any more. If I run your code and
give you an exception trace, you'll have to check out my version of
the code to be able to understand anything. Theoretically that could
be solved (eg you absolutely always run the checked-in version - of
course, that assumes that everyone's smudge and clean will perfectly
recreate the exact same output), but even with editor support, where
you'd move the cursor around and the line number would go berserk
(press down-arrow three times and the line number goes 5, 6, 6, 10),
it would be a pain.

Code is a text file. So is music (I use GNU LilyPond, and everything
works like code). So is data, in many many cases. So is configuration,
often, although some programs prefer to work with an opaque format.
About the only thing that really definitely shouldn't be massaged into
text is actual 2D images. Can you turn this into a few lines of code?

https://lh3.googleusercontent.com/-_8upQkJcvjE/UhTJlDzW3ZI/AAAAAAAABU8/QvExuUq47dI/s512/DSCF7600.JPG

Pretty much everything else, though, works better as plain text.

ChrisA

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


Thread

PEP 8 : Maximum line Length : Ganesh Pal <ganesh1pal@gmail.com> - 2014-05-13 12:37 +0530
  Re: PEP 8 : Maximum line Length : Rustom Mody <rustompmody@gmail.com> - 2014-05-13 04:52 -0700
    Re: PEP 8 : Maximum line Length : Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-05-13 13:46 +0000
      Re: PEP 8 : Maximum line Length : Ben Finney <ben@benfinney.id.au> - 2014-05-14 08:55 +1000
        Re: PEP 8 : Maximum line Length : Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-05-14 12:24 +1200
      Re: PEP 8 : Maximum line Length : Terry Reedy <tjreedy@udel.edu> - 2014-05-14 17:09 -0400
    Re: PEP 8 : Maximum line Length : albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-05-14 22:53 +0000
      Re: PEP 8 : Maximum line Length : Gary Herron <gary.herron@islandtraining.com> - 2014-05-14 17:15 -0700
      Re: PEP 8 : Maximum line Length : Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-05-15 02:16 +0100
        Re: PEP 8 : Maximum line Length : Roy Smith <roy@panix.com> - 2014-05-14 22:12 -0400
          Re: PEP 8 : Maximum line Length : Dave Angel <davea@davea.name> - 2014-05-15 08:16 -0400
      Re: PEP 8 : Maximum line Length : Rustom Mody <rustompmody@gmail.com> - 2014-05-14 19:36 -0700
        Re: PEP 8 : Maximum line Length : Ben Finney <ben@benfinney.id.au> - 2014-05-15 12:43 +1000
          Re: PEP 8 : Maximum line Length : Johannes Bauer <dfnsonfsduifb@gmx.de> - 2014-05-15 14:32 +0200
            Re: PEP 8 : Maximum line Length : Marko Rauhamaa <marko@pacujo.net> - 2014-05-15 16:07 +0300
              Re: PEP 8 : Maximum line Length : Chris Angelico <rosuav@gmail.com> - 2014-05-15 23:31 +1000
                Re: PEP 8 : Maximum line Length : alister <alister.nospam.ware@ntlworld.com> - 2014-05-15 13:38 +0000
                Re: PEP 8 : Maximum line Length : Chris Angelico <rosuav@gmail.com> - 2014-05-15 23:44 +1000
                Re: PEP 8 : Maximum line Length : alister <alister.nospam.ware@ntlworld.com> - 2014-05-15 19:29 +0000
              Re: PEP 8 : Maximum line Length : Rustom Mody <rustompmody@gmail.com> - 2014-05-15 06:53 -0700
                Re: PEP 8 : Maximum line Length : Roy Smith <roy@panix.com> - 2014-05-15 09:58 -0400
                Re: PEP 8 : Maximum line Length : Chris Angelico <rosuav@gmail.com> - 2014-05-16 00:14 +1000
                Re: PEP 8 : Maximum line Length : Rustom Mody <rustompmody@gmail.com> - 2014-05-15 07:15 -0700
                Re: PEP 8 : Maximum line Length : Marko Rauhamaa <marko@pacujo.net> - 2014-05-15 17:29 +0300
                Re: PEP 8 : Maximum line Length : Skip Montanaro <skip@pobox.com> - 2014-05-15 09:38 -0500
                Re: PEP 8 : Maximum line Length : Chris Angelico <rosuav@gmail.com> - 2014-05-16 00:42 +1000
                Re: PEP 8 : Maximum line Length : Terry Reedy <tjreedy@udel.edu> - 2014-05-15 17:50 -0400
                Re: PEP 8 : Maximum line Length : MRAB <python@mrabarnett.plus.com> - 2014-05-16 01:05 +0100
                Re: PEP 8 : Maximum line Length : Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-05-15 17:18 +0100
                Re: PEP 8 : Maximum line Length : Marko Rauhamaa <marko@pacujo.net> - 2014-05-15 17:12 +0300
                Re: PEP 8 : Maximum line Length : Chris Angelico <rosuav@gmail.com> - 2014-05-16 00:24 +1000
                Re: PEP 8 : Maximum line Length : Marko Rauhamaa <marko@pacujo.net> - 2014-05-15 17:36 +0300
                Re: PEP 8 : Maximum line Length : Chris Angelico <rosuav@gmail.com> - 2014-05-16 01:03 +1000
                Re: PEP 8 : Maximum line Length : Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-05-16 06:25 +0000
                Re: PEP 8 : Maximum line Length : Ben Finney <ben@benfinney.id.au> - 2014-05-16 16:54 +1000
                Re: PEP 8 : Maximum line Length : Marko Rauhamaa <marko@pacujo.net> - 2014-05-16 10:00 +0300
                Re: PEP 8 : Maximum line Length : Chris Angelico <rosuav@gmail.com> - 2014-05-16 17:39 +1000
                Re: PEP 8 : Maximum line Length : Marko Rauhamaa <marko@pacujo.net> - 2014-05-16 12:18 +0300
                Re: PEP 8 : Maximum line Length : Chris Angelico <rosuav@gmail.com> - 2014-05-16 19:40 +1000
                Re: PEP 8 : Maximum line Length : Marko Rauhamaa <marko@pacujo.net> - 2014-05-16 13:48 +0300
                Re: PEP 8 : Maximum line Length : Chris Angelico <rosuav@gmail.com> - 2014-05-16 17:36 +1000
              Re: PEP 8 : Maximum line Length : Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-05-16 00:21 +0000
            Re: PEP 8 : Maximum line Length : Chris Angelico <rosuav@gmail.com> - 2014-05-15 23:27 +1000
              Re: PEP 8 : Maximum line Length : Rustom Mody <rustompmody@gmail.com> - 2014-05-15 06:58 -0700
                Re: PEP 8 : Maximum line Length : Terry Reedy <tjreedy@udel.edu> - 2014-05-15 18:21 -0400
                Re: PEP 8 : Maximum line Length : Rustom Mody <rustompmody@gmail.com> - 2014-05-15 17:06 -0700
                Re: PEP 8 : Maximum line Length : Ben Finney <ben@benfinney.id.au> - 2014-05-16 10:21 +1000
                Re: PEP 8 : Maximum line Length : Rustom Mody <rustompmody@gmail.com> - 2014-05-15 20:03 -0700
                Re: PEP 8 : Maximum line Length : Ben Finney <ben@benfinney.id.au> - 2014-05-16 16:12 +1000
                Re: PEP 8 : Maximum line Length : Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-05-16 07:05 +0000
                Re: PEP 8 : Maximum line Length : Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-05-16 02:25 +0000
            Re: PEP 8 : Maximum line Length : Ben Finney <ben@benfinney.id.au> - 2014-05-16 09:32 +1000
        Re: PEP 8 : Maximum line Length : Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-05-15 03:28 +0000
          Re: PEP 8 : Maximum line Length : Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-05-15 20:18 -0400
        Re: PEP 8 : Maximum line Length : Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-05-15 04:44 +0100
  Re: PEP 8 : Maximum line Length : Roy Smith <roy@panix.com> - 2014-05-13 08:09 -0400
    Re: PEP 8 : Maximum line Length : Ben Finney <ben@benfinney.id.au> - 2014-05-13 22:26 +1000
      Re: PEP 8 : Maximum line Length : Roy Smith <roy@panix.com> - 2014-05-13 20:51 -0400
    Re: PEP 8 : Maximum line Length : Tim Chase <python.list@tim.thechases.com> - 2014-05-13 07:52 -0500

csiph-web