Re: The worth of comments

2011-05-31 Thread Neil Cerutti
On 2011-05-28, Roy Smith wrote: > One reasonable definition of a bug is something the code > actually does which differs from the documented interface. > Unless you know what the code is supposed to do, how can you > possibly look at it and say whether it has a bug or not? For > example, take thi

Re: The worth of comments

2011-05-29 Thread Alister Ware
On Sun, 29 May 2011 12:47:52 +1200, Gregory Ewing wrote: > Irmen de Jong wrote: > >> I don't see how that is opposed to what Grant was saying. It's that >> these 'contracts' tend to change and that people forget or are too lazy >> to update the comments to reflect those changes. > > However, I c

Re: The worth of comments

2011-05-29 Thread Roy Smith
In article , Grant Edwards wrote: > On 2011-05-29, Gregory Ewing wrote: > > Ben Finney wrote: > > > >> You omit the common third possibility: *both* the comment and the code > >> are wrong. > > > > In that case, the correct response is to fix both of them. :-) > > Only as a last resort. IMO, t

Re: The worth of comments

2011-05-29 Thread Grant Edwards
On 2011-05-29, Gregory Ewing wrote: > Ben Finney wrote: > >> You omit the common third possibility: *both* the comment and the code >> are wrong. > > In that case, the correct response is to fix both of them. :-) Only as a last resort. IMO, the best option is to fix the code so it's purpose and o

Re: The worth of comments

2011-05-29 Thread Gregory Ewing
Ben Finney wrote: You omit the common third possibility: *both* the comment and the code are wrong. In that case, the correct response is to fix both of them. :-) -- Greg -- http://mail.python.org/mailman/listinfo/python-list

Re: The worth of comments

2011-05-28 Thread Irmen de Jong
On 29-5-2011 2:47, Gregory Ewing wrote: > Irmen de Jong wrote: > >> I don't see how that is opposed to what Grant was saying. It's that these >> 'contracts' >> tend to change and that people forget or are too lazy to update the comments >> to reflect >> those changes. > > However, I can't see t

Re: The worth of comments

2011-05-28 Thread Ben Finney
Gregory Ewing writes: > If the contract comment doesn't match what code does, then there are > two possibilities -- the comment is wrong, or the code is wrong. The > appropriate response is to find out which one is wrong and fix it. You omit the common third possibility: *both* the comment and t

Re: The worth of comments

2011-05-28 Thread Gregory Ewing
Irmen de Jong wrote: I don't see how that is opposed to what Grant was saying. It's that these 'contracts' tend to change and that people forget or are too lazy to update the comments to reflect those changes. However, I can't see that deleting the comment documenting the contract can be the

Re: The worth of comments

2011-05-28 Thread Irmen de Jong
On 28-5-2011 15:36, Roy Smith wrote: > In article , > Grant Edwards wrote: > >> When trying to find a bug in code written by sombody else, I often >> first go through and delete all of the comments so as not to be >> mislead. > > I've heard people say that before. While I get the concept, I do

Re: The worth of comments

2011-05-28 Thread Chris Angelico
On Sat, May 28, 2011 at 11:36 PM, Roy Smith wrote: > def foo(): >   "Raise IndexError.  This is useful as a testing fixture." >   l = [1, 2, 3] >   return l[3] A quite useful thing, on occasion. I have a couple of variants of this, actually. In one of my C++ programs: extern char *death1; extern

Re: The worth of comments

2011-05-28 Thread Roy Smith
In article , Grant Edwards wrote: > When trying to find a bug in code written by sombody else, I often > first go through and delete all of the comments so as not to be > mislead. I've heard people say that before. While I get the concept, I don't like doing things that way myself. >> The co

Re: The worth of comments

2011-05-28 Thread python
Irmen, > I'm going to share this thread, and the funny slideshow about Uncomment your > code, with my team at work :-) We're not a Python shop so I'm probably the > only one reading this Same here! > but as usual there is a lot of wisdom going on in this new[s]group that is > not only applica

Re: The worth of comments

2011-05-28 Thread Irmen de Jong
On 27-5-2011 19:53, Grant Edwards wrote: > On 2011-05-27, Irmen de Jong wrote: >> On 27-05-11 15:54, Grant Edwards wrote: >>> On 2011-05-27, Ben Finney wrote: Richard Parker writes: > On May 26, 2011, at 4:28 AM, python-list-requ...@python.org wrote: > >> My experience is t

Re: The worth of comments

2011-05-28 Thread Gregory Ewing
Grant Edwards wrote: After hearing/reading somebody for years, I don't seem to have a detailed image of them in my head, but when I finally do see a picture of them, my initial reaction is almost always "no, that's not at all what I thought he/she looked like". It works the other way, too. I'v

RE: The worth of comments

2011-05-27 Thread Prasad, Ramit
>(Did I *really* write that code? It has my name on it.) Damn those ninja programmers who stole your name and coded something! Ramit Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology 712 Main Street | Houston, TX 77002 work phone: 713 - 216 - 5423 This communication

Re: The worth of comments

2011-05-27 Thread Patty
- Original Message - From: "Ethan Furman" To: Sent: Friday, May 27, 2011 11:14 AM Subject: Re: The worth of comments Miki Tebeka wrote: https://docs.google.com/present/view?id=ah82mvnssv5d_162dbgx78gw ;) +1 That was hilarious. ~Ethan~ -- http://mail.python.o

Re: The worth of comments

2011-05-27 Thread Ethan Furman
Miki Tebeka wrote: https://docs.google.com/present/view?id=ah82mvnssv5d_162dbgx78gw ;) +1 That was hilarious. ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: The worth of comments

2011-05-27 Thread Grant Edwards
On 2011-05-27, Irmen de Jong wrote: > On 27-05-11 15:54, Grant Edwards wrote: >> On 2011-05-27, Ben Finney wrote: >>> Richard Parker writes: >>> On May 26, 2011, at 4:28 AM, python-list-requ...@python.org wrote: > My experience is that comments in Python are of relatively low >

Re: The worth of comments

2011-05-27 Thread Grant Edwards
On 2011-05-27, Miki Tebeka wrote: > https://docs.google.com/present/view?id=ah82mvnssv5d_162dbgx78gw ;) I just realized that Usenet is sort of like radio. After hearing/reading somebody for years, I don't seem to have a detailed image of them in my head, but when I finally do see a picture of

Re: The worth of comments

2011-05-27 Thread Irmen de Jong
On 27-05-11 15:54, Grant Edwards wrote: On 2011-05-27, Ben Finney wrote: Richard Parker writes: On May 26, 2011, at 4:28 AM, python-list-requ...@python.org wrote: My experience is that comments in Python are of relatively low usefulness. (For avoidance of doubt: not *zero* usefulness, mere

Re: The worth of comments

2011-05-27 Thread Miki Tebeka
https://docs.google.com/present/view?id=ah82mvnssv5d_162dbgx78gw ;) -- http://mail.python.org/mailman/listinfo/python-list

Re: The worth of comments

2011-05-27 Thread Grant Edwards
On 2011-05-27, Ben Finney wrote: > Richard Parker writes: > >> On May 26, 2011, at 4:28 AM, python-list-requ...@python.org wrote: >> >> > My experience is that comments in Python are of relatively low >> > usefulness. (For avoidance of doubt: not *zero* usefulness, merely >> > low.) I've seen pl

Re: The worth of comments

2011-05-27 Thread Roy Smith
In article , Chris Angelico wrote: > (Did I *really* write that code? It has my name on it.) Most version control systems have an annotate command which lets you see who wrote a given line of code. Some of them are even honest enough to call the command "blame" instead of "annotate" :-)

Re: The worth of comments

2011-05-27 Thread D'Arcy J.M. Cain
On Fri, 27 May 2011 00:02:23 -0700 Tim Roberts wrote: > Ruby has a lot of followers, and I am trying to get excited about it, but > it has succumbed to the same special-characters-as-syntax disease that > killed Perl. Much Ruby code is just unreadable. What? The recent Perl flame war wasn't eno

Re: The worth of comments

2011-05-27 Thread Tim Roberts
Roy Smith wrote: > >Over the years, my use of comments has evolved. I was taught, "You >should comment your code". Eventually, I came to realize that the real >mandate is, "You should make it easy to understand your code". Comments >are just one possible tool to help achieve that goal. Abso

Re: The worth of comments

2011-05-26 Thread Chris Angelico
On Fri, May 27, 2011 at 12:08 PM, Roy Smith wrote: >  Sometimes > I'll drop in suggestions to future maintainers like, "consider > refactoring with with perform_frobnitz_action()" Usually, I address future-me with comments like that (on the assumption that there's nobody in the world sadistic eno

Re: The worth of comments

2011-05-26 Thread Roy Smith
In article , Richard Parker wrote: > On May 26, 2011, at 4:28 AM, python-list-requ...@python.org wrote: > > > My experience is that comments in Python are of relatively low > > usefulness. (For avoidance of doubt: not *zero* usefulness, merely low.) > > I can name variables, functions and cla

Re: The worth of comments

2011-05-26 Thread Ben Finney
Richard Parker writes: > On May 26, 2011, at 4:28 AM, python-list-requ...@python.org wrote: > > > My experience is that comments in Python are of relatively low > > usefulness. (For avoidance of doubt: not *zero* usefulness, merely > > low.) I can name variables, functions and classes with sensib

Re: The worth of comments

2011-05-26 Thread Patty
- Original Message - From: "Richard Parker" To: Sent: Thursday, May 26, 2011 11:50 AM Subject: The worth of comments On May 26, 2011, at 4:28 AM, python-list-requ...@python.org wrote: My experience is that comments in Python are of relatively low usefulness. (For avoidance of dou