Path: csiph.com!usenet.pasdenom.info!news.etla.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'debug': 0.07; '22,': 0.09; 'name?': 0.09; 'sure,': 0.09; 'url:github': 0.09; 'cc:addr:python- list': 0.11; 'def': 0.12; "':'": 0.16; '*why*': 0.16; '10:00': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'function?': 0.16; 'happily': 0.16; 'readability': 0.16; 'url:py': 0.16; 'subject:python': 0.16; '(you': 0.16; 'wrote:': 0.18; 'meant': 0.20; 'help.': 0.21; 'cc:addr:python.org': 0.22; 'instance,': 0.24; 'skip:{ 20': 0.24; 'mon,': 0.24; 'cc:2**0': 0.24; 'this:': 0.26; 'header:In-Reply-To:1': 0.27; 'idea': 0.28; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'comments': 0.31; 'comments,': 0.31; 'lot.': 0.31; 'sep': 0.31; 'subject:some': 0.31; 'though.': 0.31; 'url:python': 0.33; 'but': 0.35; 'received:google.com': 0.35; 'doing': 0.36; 'so,': 0.37; 'too': 0.37; 'pm,': 0.38; 'bad': 0.39; 'places': 0.64; 'more': 0.64; 'subject:!!!': 0.74; 'subject:get': 0.81; 'hour,': 0.84; 'url:master': 0.84; 'subject:Love': 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=FuqGKDbuX480kG3rTMUr2LdUmp84IlCeSuFm8tTkvMQ=; b=jyjaO2pESZrSCzPnJ4o6UbEmJ5uAx1Xvok9VMkR6h1fZJDC9+DxJm+JlXMiq65+0Ae PdyCPH5/nJtFK2V3y8jRqs7almnZisoM6yYHvG5eLwRK8ATC8GQOXmm1cOZ3IrZuLAT/ UdYuuLYo+F4rPJ+0Y4gtZaRW/GN5hSvYmuFNJnFPvhX6Z8ThV+XwBU/M83XeVyTPOiDU dvXoMdsl4whIAJhoJINGKmydsVsY7PQMhXNcr2QYrWBBom1m471eSbxL/y3nxh4iJ0C9 4om5twoN53SPplzHhy9I8xZcjpCWWrYt+CW5ZmWq1YHB/OtSPdrv4HVuAa+GtSMyCZ0k PLew== MIME-Version: 1.0 X-Received: by 10.50.176.202 with SMTP id ck10mr14160124igc.2.1411388580201; Mon, 22 Sep 2014 05:23:00 -0700 (PDT) In-Reply-To: <4e75613a-706a-4441-b94a-49dbedf3df28@googlegroups.com> References: <42e68de9-7528-46fc-8c74-c0baa1d6199e@googlegroups.com> <4e75613a-706a-4441-b94a-49dbedf3df28@googlegroups.com> Date: Mon, 22 Sep 2014 22:23:00 +1000 Subject: Re: Love to get some feedback on my first python app!!! From: Chris Angelico Cc: "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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 30 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1411388582 news.xs4all.nl 2851 [2001:888:2000:d::a6]:54809 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:78141 On Mon, Sep 22, 2014 at 10:00 PM, wrote: > https://github.com/Veek/Python/blob/master/IRC/Hexchat/fake_ctcp.py > that's not too bad as far as readability is concerned and it's bereft of all comments {:p Sure, I can work out what it's doing without comments. Doesn't mean comments are bad, though. Also, without comments, I have no idea *why* it's doing what it does. For instance, this: > def debug(msg): > hexchat.prnt('{}'.format(msg)) Why not just do this: debug = hexchat.prnt Or, better still, just use hexchat.prnt() everywhere, instead of having a local name? (You happily use hexchat.* in other places.) Is it meant to be monkey-patched externally? Is it meant to be a one-place edit? What's the purpose of this one-line function? > date = str(date_s) + ' ' + str(hour) + ':' + str(min) + ':' + str(sec) You use .format() in places where it's completely unnecessary, but eschew it when it would make your code more readable. date = "%s %s:%s:%s" % (date_s, hour, min, sec) date = "{} {}:{}:{}".format(date_s, hour, min, sec) So, comments would definitely help. In some cases, would help a lot. ChrisA