Earlier quoted context omitted.
def clean_start_year(x): # Account for the 7 year offset in the database return x + 7 def process_record(record): record['start year'] = clean_start_year(record['record']) It's perfectly obvious what this code does, but without the comment it's totally unclear why it does what it does.
const database_year_offset = 7; fix_start_year(year): return year + database_year_offset; process_record(record): record['start year'] = fix_start_year(record['record']); In this version with one less magic constant (and renamed function), the comment would look very redundant. DougBTX had the same idea, at the same time. I don't think their version needs the comment either. EDIT: Dang you removed a perfectly fine po…
Informative comments cannot always be "factored out" like this. Do you at least agree that a ticket or bug #, or a link to an issue in an issue tracker, would be appropriate?