[Python-checkins] bpo-38771: Explict test for None in code example (GH-17108)
Raymond Hettinger
webhook-mailer at python.org
Mon Nov 11 19:50:00 EST 2019
https://github.com/python/cpython/commit/98480cef9dba04794bd61c7e7cca643d384c8c35
commit: 98480cef9dba04794bd61c7e7cca643d384c8c35
branch: master
author: Jonathan Scholbach <j.scholbach at posteo.de>
committer: Raymond Hettinger <rhettinger at users.noreply.github.com>
date: 2019-11-11T16:49:41-08:00
summary:
bpo-38771: Explict test for None in code example (GH-17108)
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