[Python-checkins] bpo-38771: Explict test for None in code example (GH-17108) (GH-17109)
Raymond Hettinger
webhook-mailer at python.org
Mon Nov 11 19:59:18 EST 2019
https://github.com/python/cpython/commit/d8e08456025d9349abbf76035c821d3f7b2d722a
commit: d8e08456025d9349abbf76035c821d3f7b2d722a
branch: 3.8
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: Raymond Hettinger <rhettinger at users.noreply.github.com>
date: 2019-11-11T16:59:14-08:00
summary:
bpo-38771: Explict test for None in code example (GH-17108) (GH-17109)
(cherry picked from commit 98480cef9dba04794bd61c7e7cca643d384c8c35)
Co-authored-by: Jonathan Scholbach <j.scholbach at posteo.de>
files:
M Doc/library/collections.rst
diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst
index 90a3f4bea9a45..a5e8d04099b22 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'])
More information about the Python-checkins
mailing list