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


Groups > comp.lang.python > #78152

Re: Love to get some feedback on my first python app!!!

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <joel.goldstick@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.036
X-Spam-Evidence '*H*': 0.93; '*S*': 0.00; 'class,': 0.07; 'json': 0.07; 'skip:u 30': 0.07; '22,': 0.09; 'function,': 0.09; 'api': 0.11; 'cc:addr:python-list': 0.11; 'python': 0.11; 'bug': 0.12; 'useful,': 0.14; "'b'": 0.16; "['a',": 0.16; 'comments:': 0.16; 'docstrings': 0.16; 'golden': 0.16; 'instance:': 0.16; 'redundant': 0.16; 'simplest': 0.16; 'skip:j 30': 0.16; 'spotted': 0.16; 'subject:python': 0.16; 'weird': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'written': 0.21; 'code,': 0.22; 'rules': 0.22; 'saying': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; 'mind.': 0.24; 'module,': 0.24; 'mon,': 0.24; 'cc:2**0': 0.24; "i've": 0.25; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'comments': 0.31; 'easier': 0.31; '(although': 0.31; 'cells': 0.31; 'comments,': 0.31; 'sep': 0.31; 'subject:some': 0.31; 'summary': 0.32; 'run': 0.32; 'quite': 0.32; 'up.': 0.33; '-----': 0.33; 'comment': 0.34; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'belong': 0.36; 'next': 0.36; 'thanks': 0.36; 'should': 0.36; 'email addr:python.org': 0.37; 'easily': 0.37; 'being': 0.38; 'feedback': 0.38; 'others.': 0.38; 'subject:': 0.39; "couldn't": 0.39; 'changed': 0.39; 'read': 0.60; 'future': 0.60; 'most': 0.60; 'tell': 0.60; 'break': 0.61; 'first': 0.61; 're:': 0.63; 'myself': 0.63; 'more': 0.64; 'love': 0.65; 'email name:python-list': 0.65; 'url:0': 0.67; 'importantly,': 0.68; 'results': 0.69; 'url:v': 0.71; 'obvious': 0.74; 'repeat': 0.74; 'subject:!!!': 0.74; 'subject:get': 0.81; 'url:search': 0.81; '10:32': 0.84; 'comment.': 0.84; 'cult': 0.84; 'url:ajax': 0.84; 'joel': 0.91; 'subject:Love': 0.91; 'to:none': 0.92; 'angry': 0.93
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=qHHJ1EtAMQQjEYdIBJOkkAxoJ7hrh06AQAzQQ8h0ojk=; b=0LQITI4Xc2ViT/IcSs+5rR4WPXQ4fnzwxB/Q7CKL2PRB5jTt3EbQqmRhtgbfgOmNf4 Mhoph1U5K9rm9bQFfqyRo14detUCYKEbZMkhKvsgcKSa72b1pKExW3TAHT2NZ8T56iQr 7JTqHiLLfvQVOuLQHZdR0SFyC8iGgcz7IXEhfbaJmCn0SCDfsyuktPv+zpoWoREdrvBK Sd5nelRq+lgGh/OE1Ixz5P8Bp7hHS5OQOhI7rVEzvwekB76HEflIEveF/acbY3OIVgaH 55QEpJKsu7LsgkqAfZoO9kHwQYCfgB4FkqQArvPt8tknY7c+R7n/4PsemKObsrsqpbK1 HruQ==
MIME-Version 1.0
X-Received by 10.140.20.105 with SMTP id 96mr11257358qgi.33.1411397132329; Mon, 22 Sep 2014 07:45:32 -0700 (PDT)
In-Reply-To <1875566412.7055487.1411396347279.JavaMail.root@sequans.com>
References <CAPTjJmpwPbsrpiRkm7OLrsS-m=X3QnX_-Um0OvOxFXHtTy58eA@mail.gmail.com> <1875566412.7055487.1411396347279.JavaMail.root@sequans.com>
Date Mon, 22 Sep 2014 10:45:32 -0400
Subject Re: Love to get some feedback on my first python app!!!
From Joel Goldstick <joel.goldstick@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.14208.1411397141.18130.python-list@python.org> (permalink)
Lines 51
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1411397141 news.xs4all.nl 2943 [2001:888:2000:d::a6]:46887
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:78152

Show key headers only | View raw


On Mon, Sep 22, 2014 at 10:32 AM, Jean-Michel Pichavant
<jeanmichel@sequans.com> wrote:
> ----- Original Message -----
>> From: "Chris Angelico" <rosuav@gmail.com>
>> Cc: python-list@python.org
>> Sent: Saturday, 20 September, 2014 4:58:44 PM
>> Subject: Re: Love to get some feedback on my first python app!!!
> [snip]
>>
>>     #search API
>>     rawData =
>>     urllib.urlopen('http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q='+encodedQuery).read()
>>     #loads data from API into json
>>     jsonData = json.loads(rawData)
>>     #extracts the results from API
>>     searchResults = jsonData['responseData']['results']
>>
>> The more normal way to write these would be in present tense, in a
>> more imperative style: "Fix some bugs", "Load data", "Extract
>> results". (Although these comments are actually quite redundant - all
>> they do is tell you what the single next line of code does.)
>
> I used to belong to the cult "don't repeat yourself" in the comments, being angry against people who thought I couldn't understand by myself the simplest line of code.
>
> But I changed my mind. I've read some code comments over the years and best ones (imo) where those which where actually repeating themselves.
> Golden rules of comments:
>
> # state what you plan to do
> doIt()
>
> For instance:
>
> cells = ['a', 'b' 'c']
> # print the first cell
> print cell[1]
>
> A bug that is easily spotted thanks to the comment. It's all about implementation versus intentions. Also note that comment should be written for the future self,  and most importantly, for the current others.
>
> JM
>
Docstrings -- look them up.  Then you can run pydocs (and help!) on
your code and see excellent documentation

I would break up the big function into a few smaller ones that are
easier to describe.  Unless there is something very weird in the code,
I don't think #inline comments saying the obvious are useful, but a
summary at the top of the module, function, class, etc. is important

-- 
Joel Goldstick
http://joelgoldstick.com

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


Thread

Re: Love to get some feedback on my first python app!!! Joel Goldstick <joel.goldstick@gmail.com> - 2014-09-22 10:45 -0400

csiph-web