I think there's a spectrum here, and I'll clarify the stances.
The spectrum ranges from "Data shouldn't cause the function to do (something wildly) different" to "It should be allowed, even to the point of variable returns"
I think you stand on the former while I stand on the latter.
Correct me if I'm wrong though, but that's the vibe I'm getting from the tone in your example.
Data shouldn’t drive the program in this way.
Suppose we have a function that calculates a price of an object.
I feel it is agreeable for us to have compute_price(with_discount: bool), over compute_price_with_discount() + compute_price_without_discount()
You’ve basically spelled:
I feel your point your making in the example is a bit exaggerated.
Again, coming back to my above example, I don't think we would construe it as compute_price('with_discount').
Maybe this is bandwagoning, but one of the reason for my stance is that there are quite a few examples of variable returns.
eg:
getattr may return a different type base on the key given
- quite a few functions in
numpy returns different things based on flags. SVD will return S if compute_uv=False and S,U,V otherwise