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


Groups > comp.lang.python > #78151

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!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <prvs=335e18db2=jeanmichel@sequans.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.200
X-Spam-Level *
X-Spam-Evidence '*H*': 0.60; '*S*': 0.00; 'json': 0.07; 'skip:u 30': 0.07; 'api': 0.11; 'cc:addr:python-list': 0.11; 'python': 0.11; 'bug': 0.12; "'b'": 0.16; "['a',": 0.16; 'comments:': 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; 'code.': 0.18; 'written': 0.21; 'rules': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; 'mind.': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; "i've": 0.25; 'header:In-Reply-To:1': 0.27; 'code': 0.31; 'comments': 0.31; '(although': 0.31; 'cells': 0.31; 'comments,': 0.31; 'subject:some': 0.31; 'quite': 0.32; '-----': 0.33; 'comment': 0.34; 'but': 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; 'thank': 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; 'first': 0.61; 'you.': 0.62; 'information': 0.63; 're:': 0.63; 'myself': 0.63; 'received:194': 0.64; 'more': 0.64; 'love': 0.65; 'email name :python-list': 0.65; 'to:addr:gmail.com': 0.65; 'url:0': 0.67; 'notice:': 0.67; 'importantly,': 0.68; 'person,': 0.68; 'results': 0.69; 'privileged.': 0.69; 'url:v': 0.71; 'disclose': 0.74; 'repeat': 0.74; 'subject:!!!': 0.74; 'subject:get': 0.81; 'url:search': 0.81; 'comment.': 0.84; 'cult': 0.84; 'url:ajax': 0.84; 'medium.': 0.91; 'subject:Love': 0.91; 'angry': 0.93
X-IronPort-AV E=Sophos;i="5.04,571,1406584800"; d="scan'208";a="3352105"
Date Mon, 22 Sep 2014 16:32:27 +0200 (CEST)
From Jean-Michel Pichavant <jeanmichel@sequans.com>
To Chris Angelico <rosuav@gmail.com>
In-Reply-To <CAPTjJmpwPbsrpiRkm7OLrsS-m=X3QnX_-Um0OvOxFXHtTy58eA@mail.gmail.com>
Subject Re: Love to get some feedback on my first python app!!!
MIME-Version 1.0
X-Mailer Zimbra 7.2.7_GA_2942 (ZimbraWebClient - GC35 (Linux)/7.2.7_GA_2942)
Content-Type text/plain; charset="utf-8"
Content-Transfer-Encoding base64
Cc python-list@python.org
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.14207.1411396348.18130.python-list@python.org> (permalink)
Lines 33
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1411396348 news.xs4all.nl 2886 [2001:888:2000:d::a6]:42875
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:78151

Show key headers only | View raw


----- 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



-- IMPORTANT NOTICE: 

The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

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


Thread

Re: Love to get some feedback on my first python app!!! Jean-Michel Pichavant <jeanmichel@sequans.com> - 2014-09-22 16:32 +0200
  Re: Love to get some feedback on my first python app!!! alister <alister.nospam.ware@ntlworld.com> - 2014-09-22 15:23 +0000

csiph-web