Path: csiph.com!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail From: Chris Angelico Newsgroups: comp.lang.python Subject: Re: Guido sees the light: PEP 8 updated Date: Sun, 17 Apr 2016 21:14:42 +1000 Lines: 29 Message-ID: References: <5711c1b3$0$1596$c3e8da3$5496439d@news.astraweb.com> <87shym6kpo.fsf@elektro.pacujo.net> <87h9f26ioa.fsf@elektro.pacujo.net> <1460809922.1918014.580580553.0AE05EE4@webmail.messagingengine.com> <878u0d7az5.fsf@elektro.pacujo.net> <8ff10001-1c49-4490-b873-018507243ea3@googlegroups.com> <877ffw5wjo.fsf@elektro.pacujo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de lHtjODCoxhMJuTAKBpjVGw4Ll780NuiVoYM4GZ9dqBaA== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.011 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'received:209.85.223': 0.03; 'subject:PEP': 0.07; 'cc:addr:python-list': 0.09; 'exceeds': 0.09; 'functioning': 0.09; 'splitting': 0.09; 'def': 0.13; '2016': 0.16; 'arbitrarily': 0.16; 'comments:': 0.16; 'elsewhere.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'said.': 0.16; 'wrote:': 0.16; 'driver': 0.18; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'portion': 0.20; 'names.': 0.22; 'code.': 0.23; 'split': 0.23; 'header:In-Reply-To:1': 0.24; '(which': 0.26; 'coding': 0.27; 'separate': 0.27; 'message- id:@mail.gmail.com': 0.27; 'function': 0.28; 'context,': 0.29; 'follows': 0.29; 'comments': 0.30; 'generally': 0.32; 'useful': 0.33; "i'll": 0.33; 'that,': 0.34; 'gets': 0.35; 'received:google.com': 0.35; 'functions.': 0.35; "isn't": 0.35; 'but': 0.36; 'received:209.85': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'really': 0.37; 'turn': 0.37; 'doing': 0.38; 'received:209': 0.38; 'names': 0.38; 'several': 0.38; 'end': 0.39; 'subject:the': 0.39; 'still': 0.40; 'some': 0.40; 'easy': 0.60; 'your': 0.60; 'real': 0.62; 'more': 0.63; 'world': 0.64; 'real-world': 0.66; "they're": 0.66; 'fact,': 0.67; 'yourself': 0.73; 'chrisa': 0.84; 'nanny': 0.84; 'toy': 0.84; 'to:none': 0.91 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; bh=/eBDG4wqXt46rnbLBQF/n1L0e22MduJScpTlQ5LP+uk=; b=Zu9gKv8RDAmWBHKBw55oyzoER80ZLqo4HPHBKFhyelYolGD6N9uC0DboL7QHecU6ez 5XsH04YP1G8exe7W6FO5bPxC4uxflzRl5wpAxff6vkkcByo34vAFBx/Dts6uKPNly/vC xJl0oq+CtW/lp99FMRp6Asu6ZZh/iwIP05tqGl2j47cEsDRps/+tjEPbV3SmMALINpQF I1DvYVVJWcLJiyyBfu568Gu0c4Zz74s/rj/FP3WHG+mGRTK53cqtCtbMyXhlx5dFNniL xdE15RQTLTQ2Yyg2SkOgSyOhY2DiLvYZvvMf0J376DnYfOcgoFoowSzl1ZxM0MMe/3fl m5+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:cc; bh=/eBDG4wqXt46rnbLBQF/n1L0e22MduJScpTlQ5LP+uk=; b=i1xC+70ANoRkaK9ZAt5/YXVU7oM8c2QJc1bhpSs6EXdtnNyJrfgFvxvTT/954tUWEK OL11vziNTj+xrfUYf5rwQ6wtl1rnq3+0HHcuO7vt76j7PHt6T8iFoj4X2HU6Q2cu+vLm 5OOWUY0ZG1U3HKIFyT2CBiRfQ3YnnZkhImX/6SfHjotXFhzR68LKtkAnF23cchA9ik51 MuF+Pl07Uh6ShKPmvFSKtUqjiv5S94d2G9fnAEAVMt+RayGkJgD+TrBGSooGIRwVndb0 s0DGdWeqe/hyBX/pcall7sovyavMiW8nno9TaQjVJeaqtrdqTT/mt2u7Lgt/9g7ykSQg k4wA== X-Gm-Message-State: AOPr4FUbG+FuF8mRRc44X+4guhWwTNombbfyLNTppNcrYw6XszB1dpjjNFZ2Mpuxc5jKulYAnRG7dgK7zr54kQ== X-Received: by 10.107.169.32 with SMTP id s32mr29137470ioe.19.1460891682188; Sun, 17 Apr 2016 04:14:42 -0700 (PDT) In-Reply-To: <877ffw5wjo.fsf@elektro.pacujo.net> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: <5711c1b3$0$1596$c3e8da3$5496439d@news.astraweb.com> <87shym6kpo.fsf@elektro.pacujo.net> <87h9f26ioa.fsf@elektro.pacujo.net> <1460809922.1918014.580580553.0AE05EE4@webmail.messagingengine.com> <878u0d7az5.fsf@elektro.pacujo.net> <8ff10001-1c49-4490-b873-018507243ea3@googlegroups.com> <877ffw5wjo.fsf@elektro.pacujo.net> Xref: csiph.com comp.lang.python:107170 On Sun, Apr 17, 2016 at 9:01 PM, Marko Rauhamaa wrote: > In fact, if you find yourself introducing coding "paragraphs" with > comments: > > def f(...): > # I'll start by doing this > ... > # segueing into the middle portion > ... > # and finish it off as follows > ... > > you had better break those paragraphs off into separate functions. Just > turn your comments into function names. It's really easy to do this in toy examples, isn't it? But the real world is not so wonderful, as Alice's nanny said. What more often happens is that, once the function exceeds the stipulated maximum, it gets split somewhat arbitrarily into a "master" function and several "part" functions, with each part having exactly one call site in the driver and exactly none elsewhere. Even if the partial functions have reasonable names (which they don't always), they're still tightly bound to the master, and end up still functioning as a single unit. Unless you can genuinely make that subfunction useful in some other context, there's not a lot of use splitting it into a function. You don't generally see those perfect "paragraphs" in real-world code. ChrisA