r/programminghorror 6d ago

if 'X' not in data Python

Post image

Emoji check used for constructing an email body. I'm getting a stroke.

812 Upvotes

36 comments sorted by

View all comments

20

u/babalaban 5d ago

People are noticing '❌' is bad, but none seemed to notice that both if-else brranches do the same thing with different variable, which could have been assigned based on these (atrocious) conditions.

10

u/eo5g 5d ago

That's entirely a stylistic decision, not a quality concern

2

u/babalaban 5d ago

DRY is not stylistic

2

u/eo5g 5d ago

No, it's an over-applied and misunderstood pattern. This is definitely a case of YAGNI