Can you explain the horror? I'm not a python dev but this looks prettyreasonable. Could it be slightly better, sure. But not quite horror levels.
Edit: In my replies are the following... People who think throwaway code from a first year uni class needs to be perfect. People who think every piece of code needs to be a work of art. People who don't understand YAGNI. People who think "I wouldn't have written it that way" is equivalent to horror.
It's fizzbuzz guys. It's not enterprise world class Web 4.0 Scale software now with AI (tm) and it doesn't have to be.
Yeah, like it’s horror in where it’s going. Another case and we need 8 switches, another and we need 16, etc., but wouldn’t technically call it horror yet until it had more cases. In its current state, it makes me wince but not cry.
I’d leave a review comment saying this makes my eyes hurt and rewrite x way if it was in a PR, but wouldn’t consider it horror.
If it was an interview I’d just ask them how they’d approach adding another case, and make sure that they recognize their current pattern isn’t scalable
A problem of this type may, hence why I would ensure they understand the limitation in an interview, and accept their answer if they show that they do.
If this was a code base, it can simply be written cleaner. But, you wouldn’t be PRing FizzBuzz. You’d be PR’ing a problem of this type
So which one do you disagree with, that this is not horror, but could be cleaner if in PR or that this would be acceptable in an interview if candidate was able to identify that this pattern doesn’t scale when I ask?
You say it wouldn't scale well, but it isn't really any worse when adding additional constraints than the traditional if elseif elseif else implementation.
If I were reviewing this I probably wouldn't complain, at worst it would be a nit to name the conditionals or something. With a dict to name the conditions it can scale as far as code realistically should before talking about data-driven implementations or a dedicated class.
Realistically it's a short enough piece of code that it can easily be rewritten later if necessary, and it isn't hairy enough that it would cause a problem to do so.
On your edit, nobody is talking like that lmao. You asked to explain how it could be horror so we did.
Saying I’d probably leave a PR comment (which can be non-blocking to merge depending on specific case)?
Or making sure an intern (only person who I might actually start with FizzBuzz in an interview) can answer a valid follow up question to test their pattern recognition?
You can say you don’t mind the switch case, who cares.😂 It’s ridiculous to get so bent up over the above two statements though
“I asked you to give me horror and you give me nit picks and made up requirements. You say I’m “bent up” but spent your Saturday talking about it.”
Read more carefully. I said it isn’t horror in current state. That if it were extended it would be. That if I were in an interview I would ask them a follow up.
That I would leave:
nit: Can reduce with: insert code
In a PR. On the Saturday thing, that’s a good one, but I’m over here laughing. This was more passive amusement. I still don’t understand what y’all are really disagreeing with. Is this how you act at work if someone leaves a nit in your PR? Yeesh
It's not that strange, it's maybe using features that are overkill for the task, but it's using them how you'd expect to use them if that's what you chose to use.
View all comments
178
u/ababcock1 Feb 28 '26 edited Feb 28 '26
Can you explain the horror? I'm not a python dev but this looks prettyreasonable. Could it be slightly better, sure. But not quite horror levels.
Edit: In my replies are the following... People who think throwaway code from a first year uni class needs to be perfect. People who think every piece of code needs to be a work of art. People who don't understand YAGNI. People who think "I wouldn't have written it that way" is equivalent to horror.
It's fizzbuzz guys. It's not enterprise world class Web 4.0 Scale software now with AI (tm) and it doesn't have to be.