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 12882 invoked from network); 4 Aug 2023 01:58:25 -0000 Received: from minnie.tuhs.org (2600:3c01:e000:146::1) by inbox.vuxu.org with ESMTPUTF8; 4 Aug 2023 01:58:25 -0000 Received: from minnie.tuhs.org (localhost [IPv6:::1]) by minnie.tuhs.org (Postfix) with ESMTP id 109564228B; Fri, 4 Aug 2023 11:58:22 +1000 (AEST) Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) by minnie.tuhs.org (Postfix) with ESMTPS id BB07242289 for ; Fri, 4 Aug 2023 11:58:15 +1000 (AEST) Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-99c93638322so66757766b.1 for ; Thu, 03 Aug 2023 18:58:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691114293; x=1691719093; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=wwqcPSjGSWPXWFiGNKENGtwC8M8pdkfLplSuXWwE5aE=; b=GbSndmtt/xTgLqmALi7Idbo9Wxxzb0MbsrDa5z7OU1n8fbAwhdeKBfknC2kUZhqRqZ 2Z7AvHhK7yVRRpjdYfjSasKU3C+B66CgyJtZ31vdAtOjFJySGDrEvU3McDklm9wN14Zv saMtkmv5mMFp8EsCbm6j86X+SsZbuOMhq20qF29lpKuSNN77Cyg2KUsAqeBfnF2oR9jy CN+JgspzKy3NyGxgPKyMJ7FAy3T0KMNWuF+ugcTEmh12sX1ZvX+lHBM6iDOncpDnyjKl A11Q6QwHSRH2Wgk4hiiawjKEiKcSJ9iUZbZtrVxdFlMz6/XeBTco4o5nBxITv2qW0IZF 4SZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691114293; x=1691719093; 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=wwqcPSjGSWPXWFiGNKENGtwC8M8pdkfLplSuXWwE5aE=; b=ByEtyNbZnQm9krmaJSzNT48S7l9ZT9T84snV0VPT7r0Ir1liU+JOlvuijfHBKKZeJA 9UfXmxy8jAMG/9Y48l0bnNom3PdEcNU+KoaKosJIM1c3haLZyjxCwpwBk+KPhitgSwPQ Z38Q9vpbkC6zRqj/36dljJvcCRoyDCOJmn0SmqPsw97efdbXIBPzaQEAfV90gA44O0uC Huf2d8pV7i3oYTpT6pXCscWrKEkKC68I6Lj7LzYS5lM8M018sx7XWTD1phtBXECcleF5 cteLhWAD/gqH9Nk5kT59JS84LP3ZmqWlP4MzxqMJB+NVpRfII/piYMfAsCrnEP/o4Adv RUkw== X-Gm-Message-State: AOJu0YzPtPn9Bldn4UvNZGTMGC1R/OG0/tNstgF1RnqMkqIXn+QDEFFT wynDLvbwHH4URTu/PgNLQDAfRkBVNoIfv1ffGKo= X-Google-Smtp-Source: AGHT+IEf/8JhKw7RfEtxofgAaDdLcUfMJOIsDhN5dp818qYEP8jSpAk2s8dMHuJ8mTetyx9qhWWmj2Mxl9ef7lYU15U= X-Received: by 2002:a17:906:318f:b0:992:2f67:cd34 with SMTP id 15-20020a170906318f00b009922f67cd34mr476726ejy.22.1691114293178; Thu, 03 Aug 2023 18:58:13 -0700 (PDT) MIME-Version: 1.0 References: <29602.1690887524@cesium.clock.org> <20230803005106.GA12652@mcvoy.com> <20230804010142.GH11023@mcvoy.com> In-Reply-To: From: Adam Thornton Date: Thu, 3 Aug 2023 18:58:01 -0700 Message-ID: To: segaloco Content-Type: multipart/alternative; boundary="000000000000b8343906020f3af4" Message-ID-Hash: W5DDNTC5KC4FNWH2SYZGSMQGW77YA2DD X-Message-ID-Hash: W5DDNTC5KC4FNWH2SYZGSMQGW77YA2DD 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: 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: --000000000000b8343906020f3af4 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable What we've done on my current project is pretty much equivalent to the route Go chose. Go has go fmt; doesn't matter what you personally believe, just run that pre-commit, and you get a consistent style. For Python we use black. Same idea. It's not what everyone would have chosen--in fact, precisely what it does is not what *anyone* on the project, probably, would have chosen--but the fact is, it does something sane and pretty readable, and then there's no fighting over style. Adam On Thu, Aug 3, 2023 at 6:28=E2=80=AFPM segaloco via TUHS wr= ote: > > That said, as a person who thinks of himself as a professional, when I = go > > in to someone else's code, I adopt their style. It's really rude to not > > do so. I've written code in GNU C style. > > > > Larry McVoy Retired to fishing http://www.mcvoy.com/lm/boat > > I've adopted a variation on this in that I try and write additions to > existing code stylistically similar to what is there, anything presenting > glue logic to some sort of external vendor library in a way resembling > their style, and then anything else is mine. > > That middle one I've found particularly helpful even for myself over the > years as there are plenty of places in the dayjob codebases I can drop in > and tell almost immediately "Oh this is a wrapper over so and so based on > the variable names" or "Yeah this is an interface to library based = on > the way the operations are named." > > Generally the only thing I have a hard time sticking to is casing, I'm a > fervent snake caser in my assembly and C code, but then fervent pascal > caser in my JavaScript and C#. Then again, that may also tie into my > middle practice in that those are the common cases seen in model examples > of those languages. One of the weirder side effects of that stylistic > practice is the rare occasion where I blindly copy something between > languages with relatively similar syntax (C to C# or JavaScript for > instance) I can tell going back later because there's a hunk of code with > snake case smack in the middle of a bunch of pascal case. I usually go a= nd > clean that up though because otherwise the codebase starts to look like a > copypaste job from StackOverflow after a while, that stuff drives me up t= he > wall. > > - Matt G. > > P.S. For TUHS subject appropriateness, I have TUHS to thank for my C styl= e > practices. I learned from KnR 2nd Edition back when I was a kid, but > diverged a bit from the typical KnR way of things for a while, when I > caught wind of TUHS and started pouring over all the code, unbeknownst to > my own consciousness I started absorbing stylistic patterns from UNIX > sources. I'm thankful to Warren and all the others who have facilitated > this community, I think TUHS should be in any programmer's bookmark list = :) > --000000000000b8343906020f3af4 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
What we've done on my current project is pretty m= uch equivalent to the route Go chose.

Go has go fm= t; doesn't matter what you personally believe, just run that pre-commit= , and you get a consistent style.=C2=A0 For Python we use black.=C2=A0 Same= idea.=C2=A0 It's not what everyone would have chosen--in fact, precise= ly what it does is not what *anyone* on the project, probably, would have c= hosen--but the fact is, it does something sane and pretty readable, and the= n there's no fighting over style.

Adam

On Thu, Aug 3, 2023 at 6:28=E2=80=AFPM segaloco via TUHS <tuhs@tuhs.org> wrote:
> That said, as a person who thinks of= himself as a professional, when I go
> in to someone else's code, I adopt their style. It's really ru= de to not
> do so. I've written code in GNU C style.
>
> Larry McVoy Retired to fishing http://www.mcvoy.com/lm/boat

I've adopted a variation on this in that I try and write additions to e= xisting code stylistically similar to what is there, anything presenting gl= ue logic to some sort of external vendor library in a way resembling their = style, and then anything else is mine.

That middle one I've found particularly helpful even for myself over th= e years as there are plenty of places in the dayjob codebases I can drop in= and tell almost immediately "Oh this is a wrapper over so and so base= d on the variable names" or "Yeah this is an interface to library= <xyz> based on the way the operations are named."

Generally the only thing I have a hard time sticking to is casing, I'm = a fervent snake caser in my assembly and C code, but then fervent pascal ca= ser in my JavaScript and C#.=C2=A0 Then again, that may also tie into my mi= ddle practice in that those are the common cases seen in model examples of = those languages.=C2=A0 One of the weirder side effects of that stylistic pr= actice is the rare occasion where I blindly copy something between language= s with relatively similar syntax (C to C# or JavaScript for instance) I can= tell going back later because there's a hunk of code with snake case s= mack in the middle of a bunch of pascal case.=C2=A0 I usually go and clean = that up though because otherwise the codebase starts to look like a copypas= te job from StackOverflow after a while, that stuff drives me up the wall.<= br>
- Matt G.

P.S. For TUHS subject appropriateness, I have TUHS to thank for my C style = practices.=C2=A0 I learned from KnR 2nd Edition back when I was a kid, but = diverged a bit from the typical KnR way of things for a while, when I caugh= t wind of TUHS and started pouring over all the code, unbeknownst to my own= consciousness I started absorbing stylistic patterns from UNIX sources.=C2= =A0 I'm thankful to Warren and all the others who have facilitated this= community, I think TUHS should be in any programmer's bookmark list :)=
--000000000000b8343906020f3af4--