<div dir="ltr"><div><div><div>I think it's again helpful to consider golang as "roughly as modern as Python, but definitely more C-inspired".<br><br></div>The thing that Python f-strings do (other than allow interpolation of arbitrary code to be executed, which can be very handy) is that they generally provide a sane default representation of the value you want. For instance, you can say:<br><br></div>print(f"Value of foo == {foo}") and you get either something sane if foo is a primitive type, or you get whatever foo's __str__() method gives you if it's an instance of a class; the default class general does something not-terrible with that, but you can add __str__() and __repr__() if you have opinions about how you want to represent your class when printed for humans or for machine consumption (effectively, __repr__() should let you reconstruct the object, while __str__() is for display to humans).<br><br></div><div>This overcomes something C doesn't easily let you do. Most of the time I'd rather not have to care whether the thing I'm printing is a string, or a pointer, or an integer, or whatever: I just want to see its value.</div><div><br></div><div>Go has %v for exactly this. It's very nice for debugging.<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Aug 4, 2023 at 1:15 PM Larry McVoy <<a href="mailto:lm@mcvoy.com">lm@mcvoy.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Perhaps it is a stretch, but I'd say that printf() is a good example of<br>
the type of thinking done by the original Unix folks. Seeing how other<br>
people didn't learn that lesson kind of underscores the good engineering<br>
done at Bell Labs.<br>
<br>
On Fri, Aug 04, 2023 at 04:11:02PM -0400, Noel Chiappa wrote:<br>
> How is discussing Python's output options related to the history of Unix?<br>
> <br>
> Noel<br>
<br>
-- <br>
---<br>
Larry McVoy Retired to fishing <a href="http://www.mcvoy.com/lm/boat" rel="noreferrer" target="_blank">http://www.mcvoy.com/lm/boat</a><br>
</blockquote></div>