diff --git a/docs/changelog/3456.doc.rst b/docs/changelog/3456.doc.rst new file mode 100644 index 000000000..1b5c9ca46 --- /dev/null +++ b/docs/changelog/3456.doc.rst @@ -0,0 +1 @@ +Updates the documentation for ``os.environ['KEY']`` when the variable does not exist - by :user:`jugmac00`. diff --git a/docs/config.rst b/docs/config.rst index ee9d1b9fe..db1c27d73 100644 --- a/docs/config.rst +++ b/docs/config.rst @@ -1635,7 +1635,8 @@ If you specify a substitution string like this:: {env:KEY} -then the value will be retrieved as ``os.environ['KEY']`` and raise an Error if the environment variable does not exist. +then the value will be retrieved as ``os.environ['KEY']`` and replaced with an empty string if the environment variable +does not exist. Environment variable substitutions with default values @@ -1645,14 +1646,14 @@ If you specify a substitution string like this:: {env:KEY:DEFAULTVALUE} -then the value will be retrieved as ``os.environ['KEY']`` and replace with DEFAULTVALUE if the environment variable does +then the value will be retrieved as ``os.environ['KEY']`` and replaced with DEFAULTVALUE if the environment variable does not exist. If you specify a substitution string like this:: {env:KEY:} -then the value will be retrieved as ``os.environ['KEY']`` and replace with an empty string if the environment variable +then the value will be retrieved as ``os.environ['KEY']`` and replaced with an empty string if the environment variable does not exist. Substitutions can also be nested. In that case they are expanded starting from the innermost expression::