Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: c.buhtz@posteo.jp Newsgroups: de.comp.lang.python Subject: =?utf-8?q?=5BPython-de=5D_Muss_ich_=25_immer_escapen=3F?= Date: Wed, 21 Jun 2023 18:29:46 +0000 Lines: 31 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Trace: news.uni-berlin.de M3nABYpfSME2KuKmq61TlAnHgeSPUz3uLvjNRmNwyoyQ== Authentication-Results: mail.python.org; dkim=pass reason="2048-bit key; unprotected key" header.d=posteo.jp header.i=@posteo.jp header.b=aot8s/pO; dkim-adsp=pass; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.jp; s=2017; t=1687372186; bh=ABCDfEvsMPVn3C5Z8kk9jETZOe34dsFq8HRiR9MfHPA=; h=MIME-Version:Content-Transfer-Encoding:Date:From:To:Subject: Message-ID:From; b=aot8s/pOA71Zpy5wGu9YSgsanzRRlhaclUlep09wB3TMLj91oA5YJNPLTlQf8bnzk NkKPcAu3D4ijW5fD1dlSEUj7g92THsf4M309iu5Y2nwfYnObZPOe2wg3lJ91s5ZfDk J6ju38PNlx9GiHNYh4zGScEU4GaGRDEvLC3hZt5KxB2BNpHK+w0ZGI9sBIxy9KMLPF db26Fk+RRl+FIPZGdCUPNl+9QQLfuAr3B0xOuJKClgnn9/fIR89BMbG7ZEVJEArlb2 tcgOdSWcJKHcvdwO6/pio6qbPL93ZTQtRxXa6PlFlu3p9wSu8gt2CPCY7gVaZpIkAb topqsQmeOXzbA== Message-ID-Hash: CRONBQTGHC43PUD56W66CGI32GUFKVKA X-Message-ID-Hash: CRONBQTGHC43PUD56W66CGI32GUFKVKA X-MailFrom: c.buhtz@posteo.jp X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-python-de.python.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9b1 Precedence: list List-Id: Die Deutsche Python Mailingliste Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Xref: csiph.com de.comp.lang.python:5992 Hallo, ein Beispiel zum Einstieg. val =3D '15' print('Trying to keep min {perc}% free inodes'.format(perc=3Dval)) Ist das korrektes valides PEP konformes Python? Meine Linter=20 (pycodestyle und ruff) sind zufrieden. Alternative (und etwas =C3=A4ltere) Schreibweise w=C3=A4re noch: val =3D '15' print('Trying to keep min %(perc)f%% free inodes'.format(perc=3Dval)) print('Trying to keep min f%% free inodes'.format(val)) Der Punkt beim letzen Codeblock ist, dass das %-Zeichen ganz klar=20 escaped werden muss. Beim ersten Codeblock scheint das nicht notwendig zu sein. Unabh=C3=A4ngig= =20 davon, was die Linter und der Python-Interpreter dazu sagen, ist meine=20 Frage, ob das formal korrekt ist. Oder muss ich eigentlich auch im=20 ersten Beispiel das % escapen, wenn ich es pedantisch richtig mache=20 m=C3=B6chte? In PEP3101 kann ich zum % Zeichen nichts finden. Dort wird nur=20 beschrieben, wie man geschweifte Klammern escaped. https://peps.python.org/pep-3101/ Christian