From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,HTML_MESSAGE,MAILING_LIST_MULTI, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 20551 invoked from network); 4 Aug 2023 20:46:08 -0000 Received: from minnie.tuhs.org (2600:3c01:e000:146::1) by inbox.vuxu.org with ESMTPUTF8; 4 Aug 2023 20:46:08 -0000 Received: from minnie.tuhs.org (localhost [IPv6:::1]) by minnie.tuhs.org (Postfix) with ESMTP id E67A142692; Sat, 5 Aug 2023 06:46:04 +1000 (AEST) Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by minnie.tuhs.org (Postfix) with ESMTPS id 70CF342694 for ; Sat, 5 Aug 2023 06:45:55 +1000 (AEST) Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-51a52a7d859so7659025a12.0 for ; Fri, 04 Aug 2023 13:45:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691181953; x=1691786753; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=i9d5azxsmm1WKH75E5vkjPyxBbT8s/b6kPCLvOvgiBo=; b=MoNu2RtIZs8RFKPXql7RLHi4y8soROEnuxVfGsFzDlUgWLVMW45Ak4AtBP5XbvjYSV ZYxsLA1puarEVdfs20RQg59lKwKu/BzTgbq1ubh7jJH76PkPj/RuHNOrRYtRYr9N8QSv tmR64DGzUPEugy0T1Jvug+5zVniY8GMVsE8SlQWUKSs/62x8k1/WFK5NkSkVwQOYOWgf pdVSBAe6nS+e2hYQXmK7Hyf+6OTH4GymEN+qs4JwNsMaw/SaMPT4GGFR34Av4TvnKLvI D+Yop0it6mxx+9llCmK+926UDNI24zoap43p1ORtXsTCu4uIEQkGG56HTBN11KF/taZJ z/Tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691181953; x=1691786753; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=i9d5azxsmm1WKH75E5vkjPyxBbT8s/b6kPCLvOvgiBo=; b=Z6Y0LKHMxf2URCRG2Wvoqz1LSHduoYjup/RNV/LUfqjyOzv3rK/r57+9r3qb76HWz+ gz8Q/8NtlWRPsteazwRckQ/rDUYV53RE1jcUqcc0cP4aZ8aVXWaSg+eD+gTbOcBOdG/B Jxg+1xppUY1uMDxJPnaSZErH9632HzKnEtCc58n2/RYYjoHKD+e15eKDKn7Nva0I/Fn+ ufedZYHqzxIBFK3J/ZnGsO1VGRxo0Gj2+H7y1VxB6aSAfoTG392uewgTxpLsdOrnHCkH QYHzd/DjiubkbtlI1Q87NsjXA2rytasPyG4AZjVDm5O+nzDemA5PdHJ0xsR3kW3pd3Br JLkw== X-Gm-Message-State: AOJu0YzdOD7IUglJRKAN3vLkr51sKxyoBNwW54V3FJDJTUakkEfOmnI4 y815YkyPxnBbZLzXc7vPUJOsSxm0hW9kEJVBvMwHmj9B X-Google-Smtp-Source: AGHT+IFpxyfDW7cnT3pzFZlWNx1aEZV+1vaf8Z/ZhcF6C/y3LCFWsz/70gEaO1gvoVYdlEf3q+L6SX8QsaUyBxqVPrc= X-Received: by 2002:aa7:cd58:0:b0:522:3a1d:c233 with SMTP id v24-20020aa7cd58000000b005223a1dc233mr939477edw.11.1691181952653; Fri, 04 Aug 2023 13:45:52 -0700 (PDT) MIME-Version: 1.0 References: <20230804201102.753C218C077@mercury.lcs.mit.edu> <20230804201551.GL24315@mcvoy.com> In-Reply-To: <20230804201551.GL24315@mcvoy.com> From: Adam Thornton Date: Fri, 4 Aug 2023 13:45:41 -0700 Message-ID: To: Larry McVoy Content-Type: multipart/alternative; boundary="00000000000089e0fe06021efb0e" Message-ID-Hash: PYWYYLAPP6O7CAAVV4HQDAFMP3OUMF3S X-Message-ID-Hash: PYWYYLAPP6O7CAAVV4HQDAFMP3OUMF3S X-MailFrom: athornton@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Noel Chiappa , tuhs@tuhs.org X-Mailman-Version: 3.3.6b1 Precedence: list Subject: [TUHS] Re: python List-Id: The Unix Heritage Society mailing list Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --00000000000089e0fe06021efb0e Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 =3D=3D {foo}") and you get either something sane if fo= o 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=E2=80=AFPM Larry McVoy 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 Uni= x? > > > > Noel > > -- > --- > Larry McVoy Retired to fishing > http://www.mcvoy.com/lm/boat > --00000000000089e0fe06021efb0e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
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 i= nterpolation 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.=C2=A0 For instance, you can say:

print(f"Value of f= oo =3D=3D {foo}") and you get either something sane if foo is a primit= ive type, or you get whatever foo's __str__() method gives you if it= 9;s an instance of a class; the default class general does something not-te= rrible with that, but you can add __str__() and __repr__() if you have opin= ions 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).

T= his overcomes something C doesn't easily let you do.=C2=A0 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.=C2=A0 It's = very nice for debugging.

On Fri, Aug 4, 2023 at 1:15=E2=80=AFPM La= rry McVoy <lm@mcvoy.com> wrote:
Perhaps it is a s= tretch, but I'd say that printf() is a good example of
the type of thinking done by the original Unix folks.=C2=A0 Seeing how othe= r
people didn't learn that lesson kind of underscores the good engineerin= g
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 o= f Unix?
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0Noel

--
---
Larry McVoy=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Retired to fishing=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 http://www.mcvoy.com/lm/boat
--00000000000089e0fe06021efb0e--