Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #78156
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!lightspeed.eweka.nl!lightspeed.eweka.nl!cyclone01.ams2.highwinds-media.com!voer-me.highwinds-media.com!peer01.am1!peering.am1!peer02.fr7!news.highwinds-media.com!post02.fr7!fx03.am4.POSTED!not-for-mail |
|---|---|
| From | alister <alister.nospam.ware@ntlworld.com> |
| Subject | Re: Love to get some feedback on my first python app!!! |
| Newsgroups | comp.lang.python |
| References | <mailman.14207.1411396348.18130.python-list@python.org> |
| User-Agent | Pan/0.139 (Sexual Chocolate; GIT bf56508 git://git.gnome.org/pan2) |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | 8bit |
| Lines | 44 |
| Message-ID | <faXTv.319653$J62.216269@fx03.am4> (permalink) |
| NNTP-Posting-Host | 82.9.78.47 |
| X-Complaints-To | http://netreport.virginmedia.com |
| X-Trace | 1411399435 82.9.78.47 (Mon, 22 Sep 2014 15:23:55 UTC) |
| NNTP-Posting-Date | Mon, 22 Sep 2014 15:23:55 UTC |
| Organization | virginmedia.com |
| Date | Mon, 22 Sep 2014 15:23:55 GMT |
| X-Received-Body-CRC | 2914098786 |
| X-Received-Bytes | 2704 |
| Xref | csiph.com comp.lang.python:78156 |
Show key headers only | View raw
On Mon, 22 Sep 2014 16:32:27 +0200, Jean-Michel Pichavant 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]
That is not too bad, "Print Customer name from cell 1" may be better as
it would stick out if the data structure changed
what is meant by don't state the obvious in comments is stating something
like "Increment x" without explaining why.
--
"It is hard to overstate the debt that we owe to men and women of genius."
-- Robert G. Ingersoll
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll 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