Re:Google Python Style Guide
by gorgoiler on Saturday February 11, 2023 @07:02AM
(#34751602)
Imagine two different call sites want to do two different things with the message. One wants to log() it, another wants to print() it. In my example this has been implemented by passing a flag to greet() to tell it what to do.
If greet() gave up responsibility for outputting the message and instead just constructed it, then your code would look like this:
If greet() gave up responsibility for outputting the message and instead just constructed it, then your code would look like this:
And greet would be half as long.