From: Adam Thornton <athornton@gmail.com>
To: Larry McVoy <lm@mcvoy.com>
Cc: Noel Chiappa <jnc@mercury.lcs.mit.edu>, tuhs@tuhs.org
Subject: [TUHS] Re: python
Date: Fri, 4 Aug 2023 13:45:41 -0700 [thread overview]
Message-ID: <CAP2nic11onhv_2mFc2N6-WuaWAqngpW875nT_n7WGmLLG+12AQ@mail.gmail.com> (raw)
In-Reply-To: <20230804201551.GL24315@mcvoy.com>
[-- Attachment #1: Type: text/plain, Size: 1740 bytes --]
I think it's again helpful to consider golang as "roughly as modern as
Python, but definitely more C-inspired".
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:
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).
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.
Go has %v for exactly this. It's very nice for debugging.
On Fri, Aug 4, 2023 at 1:15 PM Larry McVoy <lm@mcvoy.com> wrote:
> Perhaps it is a stretch, but I'd say that printf() is a good example of
> the type of thinking done by the original Unix folks. Seeing how other
> people didn't learn that lesson kind of underscores the good engineering
> done at Bell Labs.
>
> On Fri, Aug 04, 2023 at 04:11:02PM -0400, Noel Chiappa wrote:
> > How is discussing Python's output options related to the history of Unix?
> >
> > Noel
>
> --
> ---
> Larry McVoy Retired to fishing
> http://www.mcvoy.com/lm/boat
>
[-- Attachment #2: Type: text/html, Size: 2275 bytes --]
next prev parent reply other threads:[~2023-08-04 20:46 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-04 20:11 Noel Chiappa
2023-08-04 20:15 ` Larry McVoy
2023-08-04 20:45 ` Adam Thornton [this message]
-- strict thread matches above, loose matches on Subject: below --
2023-08-06 19:46 Norman Wilson
2023-08-07 6:48 ` Ed Bradford
2023-08-04 21:17 Douglas McIlroy
2023-08-04 21:30 ` Dan Cross
2023-08-04 22:36 ` Rob Pike
2023-07-30 23:59 [TUHS] Re: Cool talk on Unix and Sendmail history, by Eric Allman Erik E. Fair
2023-08-01 10:58 ` Erik E. Fair
2023-08-02 0:37 ` Dave Horsfall
2023-08-02 14:52 ` Ron Natalie
2023-08-02 21:14 ` Grant Taylor via TUHS
2023-08-02 22:20 ` segaloco via TUHS
2023-08-02 23:49 ` Rich Salz
2023-08-03 0:51 ` [TUHS] Re: python Larry McVoy
2023-08-03 1:20 ` George Michaelson
2023-08-03 2:53 ` Bakul Shah
2023-08-03 2:55 ` segaloco via TUHS
2023-08-03 3:24 ` George Michaelson
2023-08-03 3:32 ` Warner Losh
2023-08-03 3:55 ` Bakul Shah
2023-08-03 8:32 ` Rob Pike
2023-08-03 14:19 ` Bakul Shah
2023-08-03 14:56 ` Dan Halbert
2023-08-03 15:20 ` will.senn
2023-08-03 22:05 ` Dan Cross
2023-08-04 0:24 ` John Cowan
2023-08-04 15:17 ` Dan Cross
2023-08-05 4:44 ` Bakul Shah
2023-08-03 15:41 ` John Cowan
2023-08-03 2:07 ` Clem Cole
2023-08-03 2:21 ` Pete Wright via TUHS
2023-08-03 2:56 ` Warner Losh
2023-08-03 12:36 ` Mike Markowski
2023-08-03 13:29 ` Rob Pike
2023-08-03 15:24 ` emanuel stiebler
2023-08-03 15:39 ` Steffen Nurpmeso
2023-08-04 1:01 ` Larry McVoy
2023-08-04 1:28 ` segaloco via TUHS
2023-08-04 1:58 ` Adam Thornton
2023-08-04 15:04 ` Dan Cross
2023-08-04 15:10 ` Larry McVoy
2023-08-04 19:20 ` Ed Bradford
2023-08-04 19:47 ` Larry McVoy
2023-08-05 5:40 ` Ed Bradford
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAP2nic11onhv_2mFc2N6-WuaWAqngpW875nT_n7WGmLLG+12AQ@mail.gmail.com \
--to=athornton@gmail.com \
--cc=jnc@mercury.lcs.mit.edu \
--cc=lm@mcvoy.com \
--cc=tuhs@tuhs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).