From 3b128af0edab69659b4040c4f447e634b81bd554 Mon Sep 17 00:00:00 2001 From: Mark Byrne Date: Wed, 25 May 2022 18:10:03 +0200 Subject: [PATCH] Added documentation examples for `consider-using-dict-comprehension`. --- doc/data/messages/c/consider-using-dict-comprehension/bad.py | 3 +++ doc/data/messages/c/consider-using-dict-comprehension/good.py | 3 +++ 2 files changed, 6 insertions(+) create mode 100644 doc/data/messages/c/consider-using-dict-comprehension/bad.py create mode 100644 doc/data/messages/c/consider-using-dict-comprehension/good.py diff --git a/doc/data/messages/c/consider-using-dict-comprehension/bad.py b/doc/data/messages/c/consider-using-dict-comprehension/bad.py new file mode 100644 index 0000000000..78129c56fc --- /dev/null +++ b/doc/data/messages/c/consider-using-dict-comprehension/bad.py @@ -0,0 +1,3 @@ +NUMBERS = [1, 2, 3] + +DOUBLED_NUMBERS = dict([(number, number * 2) for number in NUMBERS]) # [consider-using-dict-comprehension] diff --git a/doc/data/messages/c/consider-using-dict-comprehension/good.py b/doc/data/messages/c/consider-using-dict-comprehension/good.py new file mode 100644 index 0000000000..5f91d561a8 --- /dev/null +++ b/doc/data/messages/c/consider-using-dict-comprehension/good.py @@ -0,0 +1,3 @@ +NUMBERS = [1, 2, 3] + +DOUBLED_NUMBERS = {number: number * 2 for number in NUMBERS}