From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Tue, 12 Nov 2019 00:58:49 +0000 (-0800) Subject: bpo-38771: Explict test for None in code example (GH-17108) (GH-17110) X-Git-Tag: v3.7.6rc1~62 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cb1c06e3bfbce7f4e8dcb0db84bcee54c8d4fa21;p=thirdparty%2FPython%2Fcpython.git bpo-38771: Explict test for None in code example (GH-17108) (GH-17110) (cherry picked from commit 98480cef9dba04794bd61c7e7cca643d384c8c35) Co-authored-by: Jonathan Scholbach --- diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst index e9dbd094e0a9..6488b1260d20 100644 --- a/Doc/library/collections.rst +++ b/Doc/library/collections.rst @@ -162,7 +162,7 @@ environment variables which in turn take precedence over default values:: parser.add_argument('-u', '--user') parser.add_argument('-c', '--color') namespace = parser.parse_args() - command_line_args = {k:v for k, v in vars(namespace).items() if v} + command_line_args = {k: v for k, v in vars(namespace).items() if v is not None} combined = ChainMap(command_line_args, os.environ, defaults) print(combined['color'])