[Python-ideas] Quick idea: defining variables from functions that take the variable name

Greg Ewing greg.ewing at canterbury.ac.nz
Wed Jun 1 07:32:21 EDT 2016


Sjoerd Job Postmus wrote:
> I would not even want to call it a violation. 
> DRY is about having 1 representative location for knowledge. The name of 
> a variable (1) hardly counts as knowledge and (2) is also used at other 
> locations (use-sites).

I don't know whether it meets the strict definition of DRY or
not, but the reason it's annoying is that it's a repitition
that doesn't convey any information.

Using a variable name in multiple places tells you something:
"this thing here refers to that thing defined over there".
But having the variable name in two places in the *definition*
tells you nothing.

-- 
Greg


More information about the Python-ideas mailing list