From owner-freebsd-questions@freebsd.org Thu May 14 21:13:25 2020 Return-Path: Delivered-To: freebsd-questions@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9CF8A2E006C for ; Thu, 14 May 2020 21:13:25 +0000 (UTC) (envelope-from 4250.82.1d4c10005dcdfbf.211a7ab50670b5580c7ef90c36994f60@email-od.com) Received: from s1-b0c6.socketlabs.email-od.com (s1-b0c6.socketlabs.email-od.com [142.0.176.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49NPQr07NTz3xLP for ; Thu, 14 May 2020 21:13:23 +0000 (UTC) (envelope-from 4250.82.1d4c10005dcdfbf.211a7ab50670b5580c7ef90c36994f60@email-od.com) DKIM-Signature: v=1; a=rsa-sha256; d=email-od.com;i=@email-od.com;s=dkim; c=relaxed/relaxed; q=dns/txt; t=1589490804; x=1592082804; h=content-transfer-encoding:content-type:mime-version:references:in-reply-to:message-id:subject:cc:to:from:date:x-thread-info; bh=HJrChExnBdO182PNU6+lTay8Q91h4M86X5tr8JZn7mQ=; b=CDNNhCoC4WzXW8wpMWA3vTwPVjwREATpM++EftDFaUS1p/oSICfy1L113C5H7nv1TTO9OmPsWi9u/vykZJOjnwfs44LX7u5xuoADzKKzXRmJ/XS5gJgKHrBTrRO9dzuHGhTLQ1UviEM377104q4yKmKzkMHoHOaECQlt8t/xzv8= X-Thread-Info: NDI1MC45Mi4xZDRjMTAwMDVkY2RmYmYuZnJlZWJzZC1xdWVzdGlvbnM9ZnJlZWJzZC5vcmc= Received: from r3.h.in.socketlabs.com (r3.h.in.socketlabs.com [142.0.180.13]) by mxsg2.email-od.com with ESMTP(version=Tls12 cipher=Aes256 bits=256); Thu, 14 May 2020 17:13:14 -0400 Received: from smtp.lan.sohara.org (EMTPY [185.202.17.215]) by r3.h.in.socketlabs.com with ESMTP(version=Tls12 cipher=Aes256 bits=256); Thu, 14 May 2020 17:13:13 -0400 Received: from [192.168.63.1] (helo=steve.lan.sohara.org) by smtp.lan.sohara.org with smtp (Exim 4.92.3 (FreeBSD)) (envelope-from ) id 1jZLAF-000IBX-Nd; Thu, 14 May 2020 22:13:11 +0100 Date: Thu, 14 May 2020 22:13:11 +0100 From: Steve O'Hara-Smith To: Tim Daneliuk Cc: FreeBSD Mailing List Subject: Re: Multi-line text output via printf() et al. Message-Id: <20200514221311.9c53c472269a0ba771cffcc6@sohara.org> In-Reply-To: References: <20200514220904.7a4c1e28.freebsd@edvax.de> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; amd64-portbld-freebsd12.0) X-Clacks-Overhead: "GNU Terry Pratchett" Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 49NPQr07NTz3xLP X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=email-od.com header.s=dkim header.b=CDNNhCoC; dmarc=none; spf=pass (mx1.freebsd.org: domain of 4250.82.1d4c10005dcdfbf.211a7ab50670b5580c7ef90c36994f60@email-od.com designates 142.0.176.198 as permitted sender) smtp.mailfrom=4250.82.1d4c10005dcdfbf.211a7ab50670b5580c7ef90c36994f60@email-od.com X-Spamd-Result: default: False [-1.59 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.92)[-0.919,0]; R_DKIM_ALLOW(-0.20)[email-od.com:s=dkim]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:142.0.176.0/20]; MV_CASE(0.50)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[sohara.org]; NEURAL_HAM_LONG(-1.00)[-0.997,0]; RCVD_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[email-od.com:+]; RCPT_COUNT_TWO(0.00)[2]; RCVD_IN_DNSWL_NONE(0.00)[198.176.0.142.list.dnswl.org : 127.0.15.0]; IP_SCORE(0.02)[ip: (-0.18), ipnet: 142.0.176.0/22(0.27), asn: 7381(0.07), country: US(-0.05)]; FORGED_SENDER(0.30)[steve@sohara.org,4250.82.1d4c10005dcdfbf.211a7ab50670b5580c7ef90c36994f60@email-od.com]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:7381, ipnet:142.0.176.0/22, country:US]; FROM_NEQ_ENVFROM(0.00)[steve@sohara.org,4250.82.1d4c10005dcdfbf.211a7ab50670b5580c7ef90c36994f60@email-od.com]; MID_RHS_MATCH_FROM(0.00)[] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2020 21:13:25 -0000 On Thu, 14 May 2020 15:44:18 -0500 Tim Daneliuk wrote: > However you decide to do it, can we _please_ stop embedding literal > strings in printf(), python print(), and so forth? Strings should be > pulled out as variables into one centrally maintained location in the > code. Why? That's a good start. > Because, someday, you may actually want to have your code run > with output in something other than your native language. Because > strings are often reused in several places in the code. Because you may > someday actually want to use unicode characters. Right, but then you'll probably want to compose strings with embedded variable content and discover that the order is not fixed across languages and so you need a more sophisticated interpolation markup than printf. Then you'll bump into the nightmare that is plural and singular forms, sometimes with multiple variants of plural. If you display lists you will find all the fun of sorting (just look at the French rules on sorting by accent). Do not get me started on truncation! -- Steve O'Hara-Smith