Sometimes 2 lines of code is just better than 6 and not worth the extra brain cycles.
There's DRY, then there's premature optimization.
There's DRY, then there's premature optimization.
I am unsure about what could possibly be better about them? Twice the chance to misspell one of the string constants? Twice the time to write the code, which in this case seems to be the big blocker? Twice the code to update in case any of it has to change? Twice the complexity per line of code?
In any case, DRY is just an optimization theme. And optimizing for understanding/intent is a higher priority for me. Sometimes they intersect, sometimes not.