> I'm going to go off on a tangent here and put in a plea for better > variable > naming. I'm looking at the above code, and can't figure out what "res" is > supposed to be. Is it short for "rest", as in "the rest of the items"? > Residual? Result? Restore? Any of these seems plausable. Not knowing > which makes it much harder to understand what the code does. When you say > "res.append(e)", are you building up the result that you're going to > return, or are you building up a list of elements that got eliminated > (i.e. residual) because they are duplicates? > > Yes, I did eventually figure it out. It didn't even take that long, but > this is a trivial little piece of code; it shouldn't have taken any time > at > all to figure it out. All you saved by using "res" instead of "result" > was 9 keystrokes ("ult", in three places), but it cost every one of your > readers extra brainpower to figure out what you meant. To quote one of > Aahz's better signatures, "Typing is cheap. Thinking is expensive." :-)
I usually use much more telling variable names - from the source I just wrote a minute ago: self.selection_color_map = {} self.selection_color = (255,255,0) self.assigned_color_map = {} self.default_color = (0,0,0) self.known_names = sets.Set() As you can see - no desire to shorten names. But "res" for result is as hardwired to me as i,j,k for iterating numbers. So bear with me on this case. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list