Skip to content

Commit

Permalink
Added documentation examples for consider-using-set-comprehension. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
mbyrnepr2 authored May 25, 2022
1 parent 92e5520 commit d8dbac0
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-set-comprehension/bad.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
NUMBERS = [1, 2, 2, 3, 4, 4]

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

UNIQUE_EVEN_NUMBERS = {number for number in NUMBERS if number % 2 == 0}

0 comments on commit d8dbac0

Please sign in to comment.