]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[doc] configparser: avoid inline comments. (GH-31247)
authorJulien Palard <julien@palard.fr>
Wed, 23 Mar 2022 08:35:33 +0000 (09:35 +0100)
committerGitHub <noreply@github.com>
Wed, 23 Mar 2022 08:35:33 +0000 (09:35 +0100)
People are testing those blocs with the default
inline_comment_prefixes of None, leading to a:

configparser.InterpolationSyntaxError: '$' must be followed by '$' or '{', found: '$ sign ($ is the only character that needs to be escaped)'

Doc/library/configparser.rst

index 323dd2affc78fc9a987d2927a125e7b07db9816c..72aa20d73d8bd3b82950f19d48646ac7729634aa 100644 (file)
@@ -347,7 +347,8 @@ from ``get()`` calls.
       my_pictures: %(my_dir)s/Pictures
 
       [Escape]
-      gain: 80%%  # use a %% to escape the % sign (% is the only character that needs to be escaped)
+      # use a %% to escape the % sign (% is the only character that needs to be escaped):
+      gain: 80%%
 
    In the example above, :class:`ConfigParser` with *interpolation* set to
    ``BasicInterpolation()`` would resolve ``%(home_dir)s`` to the value of
@@ -382,7 +383,8 @@ from ``get()`` calls.
       my_pictures: ${my_dir}/Pictures
 
       [Escape]
-      cost: $$80  # use a $$ to escape the $ sign ($ is the only character that needs to be escaped)
+      # use a $$ to escape the $ sign ($ is the only character that needs to be escaped):
+      cost: $$80
 
    Values from other sections can be fetched as well: