Skip to content

Commit

Permalink
Added documentation examples for consider-using-dict-comprehension. (
Browse files Browse the repository at this point in the history
  • Loading branch information
mbyrnepr2 authored May 25, 2022
1 parent de0b36b commit 92e5520
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions doc/data/messages/c/consider-using-dict-comprehension/bad.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
NUMBERS = [1, 2, 3]

DOUBLED_NUMBERS = dict([(number, number * 2) for number in NUMBERS]) # [consider-using-dict-comprehension]
3 changes: 3 additions & 0 deletions doc/data/messages/c/consider-using-dict-comprehension/good.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
NUMBERS = [1, 2, 3]

DOUBLED_NUMBERS = {number: number * 2 for number in NUMBERS}

0 comments on commit 92e5520

Please sign in to comment.