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,MAILING_LIST_MULTI, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 27842 invoked from network); 3 Aug 2023 17:29:16 -0000 Received: from minnie.tuhs.org (2600:3c01:e000:146::1) by inbox.vuxu.org with ESMTPUTF8; 3 Aug 2023 17:29:16 -0000 Received: from minnie.tuhs.org (localhost [IPv6:::1]) by minnie.tuhs.org (Postfix) with ESMTP id C43F8415F1; Fri, 4 Aug 2023 03:29:11 +1000 (AEST) Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by minnie.tuhs.org (Postfix) with ESMTPS id D6078415F0 for ; Fri, 4 Aug 2023 03:29:03 +1000 (AEST) Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-3fe2d218eedso12631755e9.0 for ; Thu, 03 Aug 2023 10:29:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691083742; x=1691688542; h=content-transfer-encoding:in-reply-to:content-language:references :to:subject:user-agent:mime-version:date:message-id:from:sender:from :to:cc:subject:date:message-id:reply-to; bh=OdAngntcljG0sfVRXMDjqquNdpcSGWBaw1iG7pApD3w=; b=CIAl5L7lr3ZkUBpmX8B1RKNp7xx3RsK97mOij2L6vs9K4Ps0gMT9z8pb38SllpJ+CL l07upZ98jBzjZbGCuXQs5mO7zSe2sWGvhEmdNc9SFFttv6ZqqArOt/ibJ66VJA5iwzU2 EFffmhPR7hOJlLyo+/wk4cHP96ZP3dDD4tWjuInrRw1Wy8ZaUB/GTHhSi80zxbpePk3Z hGGUiozRlXAihAFvB2Es4U9u3IddpjtUh6GfHOTBWfrER5y6c1EEh+krAbVJDW+XlymV NKHkrCDFk3eGfOs1erEznVuB1ZJYn0zvLQLAZfW/86wgHIc0NvmfevYLqKNS4Tz80bOD AuCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691083742; x=1691688542; h=content-transfer-encoding:in-reply-to:content-language:references :to:subject:user-agent:mime-version:date:message-id:from:sender :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=OdAngntcljG0sfVRXMDjqquNdpcSGWBaw1iG7pApD3w=; b=Je55rW6rIQGhV9l1gJfHFc5jhz2MR/pbpHLOogZsapc5fg8LQxsJeA5rW9GcOquppH WwQqsivATKdO/7blC1YWy2cI+ECx0/lyy742/ntib1ieUFi1ier8ZWgUr3gZA0Zed1kR ZcrQzrMx4YUMtgrXoNSPdLN5MsNPVifnDevXjhcQs69EeNynYpL4RKMLvCWNNgpCSxMl N2kF1qhNVFahgkpfmJRYAH6n7f9XILnnJLEPycllafKi1ekjWFIP0gF7lOR+GdvKdbOH hDeds4CokzK5NEPp+miOZUcE40b3G7HmFweUPzf2InpMR4OV7QuwTuYbQd02POEPcAnF OM4A== X-Gm-Message-State: ABy/qLaTHIWl7UreA0u6gxioX4RCkkuAFPiVkuLUcZkPQKiWdj+ykMA2 rqnoQVXakHoop+4WfGMavva6PuL9Om8= X-Google-Smtp-Source: APBJJlHiq/KYtrt8ih3/wpHD0JZs/6dKyle5ZkJRXGWd2PmRstQHv897l0k8wdsWLim3gFnCkyPEBw== X-Received: by 2002:a1c:7215:0:b0:3fb:403d:90c5 with SMTP id n21-20020a1c7215000000b003fb403d90c5mr6996028wmc.39.1691083741843; Thu, 03 Aug 2023 10:29:01 -0700 (PDT) Received: from [192.168.0.160] ([170.253.40.43]) by smtp.gmail.com with ESMTPSA id d10-20020adffd8a000000b003143ba62cf4sm354496wrr.86.2023.08.03.10.29.00 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Aug 2023 10:29:01 -0700 (PDT) Sender: Alejandro Colomar From: Alejandro Colomar X-Google-Original-From: Alejandro Colomar Message-ID: <8e45b8b1-cf3c-e47c-bd15-d19a2ae5cc1d@gmail.org> Date: Thu, 3 Aug 2023 19:29:00 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.1 To: tuhs@tuhs.org References: <8246.1690761540@cesium.clock.org> <29602.1690887524@cesium.clock.org> <20230803005106.GA12652@mcvoy.com> <202308031657.373GvVvW008640@ultimate.com> Content-Language: en-US In-Reply-To: <202308031657.373GvVvW008640@ultimate.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Message-ID-Hash: QX3P3C5NO7PWG36JRV7C4Q3ZMS5WV6GO X-Message-ID-Hash: QX3P3C5NO7PWG36JRV7C4Q3ZMS5WV6GO X-MailFrom: alx.mailinglists@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 X-Mailman-Version: 3.3.6b1 Precedence: list Subject: [TUHS] Re: [TULSA] Re: python List-Id: The Unix Heritage Society mailing list Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On 2023-08-03 18:57, Phil Budne wrote: > On the subject of "no printf", there is not one, not two, but THREE > ways to format strings, easily compounded with print: > > print("%s %s" % ("hello", "world")) > print("{1} {two}".format("hello", two="world")) > print(f"{greeting} {populace}") > > I'm pretty sure the last method (which initially made me vomit, due to > violating my hardwired ideas about complicating the lexer, as if it > can even be thought of as a separate layer), BUT I Seem To Recall that > it allows a class to implement a formatting method, which may (or may > not) work for complex numbers. Actually, there's no need to move away from printf(3) for customization. glibc provides register_printf_specifier(3), register_printf_modifier(3), and register_printf_modifier(3), with which you can register %S for printing your very nice struct. You can even register modifiers, such as %vS for printing your structure in a different manner. Of course, those APIs are not portable, but that's a matter of porting them; you don't need to invent a completely new formatted print variant just to do that. How does one even specify the equivalent of "%+'0#8.5f" in the new {} formats?? Of course, there may be reasons to move away from printf(3): C++ seems to have a faster thing with std:format (or so they claim; I didn't try it). But if speed is not a problem, I'd keep the good ol' syntax that everybody knows. No need to make everybody learn a "cool" new print function, that probably won't be as tunable as printf(3) is. Another thing is type safety. printf(3) is actually type-safe. At least as long as you use powerful compilers that can diagnose misuses of printf-like APIs. GCC provides [[gnu::format()]] for a reason. And if you customize printf with your own formats, Clang has tools for checking those too. > > Type "hinting" has been mentioned: again, it's almost like a whole new > version of the language. You need to pick a type checker, and likely > turn up the knobs to achieve any actual safety, and then deal with the > fact that not all packages supply hints out of the box. It kind of > offers the desert-topping/floor-wax dichotomy: You can easily/quickly > write small programs with dynamic typing for quick one-offs, AND write > better armored code for libraries & production code. > > On tabs vs spaces: Python3 forbids mixing them. Again, fascist, but > "it's for your own good". > > So yes, Python sucks, but I continue using it, and unlike sendmail > (which I continue to run, as I have a 200+ line .mc file it would take > me at LEAST a week to replicate the effects of in another MTA), I > don't tell people Python is unsuitable at any speed. > > I'd probably happily write Go or Rust, given a situation (existing > project/program) where its use was inevitable, and I DO have a program > I think is a good candidate for rewriting in Go, but on the whole, > it's a useful tool for many kinds of programmers, and in many > situations, which I think is somewhat remarkable. I'll go a little step further, and claim that newlines being significant is another bad decission. It's one of the things I dislike from languages, including sh(1). My scripts end up having a lot of escaped newlines, because I find the pipe to be more readable and pleasant as foo \ | bar rather than foo | bar While I can forgive that in the shell, because interactive mode is as important as scripts, I can't do the same with Go. Go is a programming language, and having newlines be significant is nonsense. Saving from typing ;s is a similar excuse that the one python used for saving typing {}s. And the consequence is that due to that fascist rule of go, I can't put the opening brace of a function declaration in a new line; it must be sticked to the same line as the function declarator. I never enjoyed Go, and that was the main reason. In any case, I never found a need for it. Most (all?) of what I do can be done with sh(1) or C. Alex