Skip to content

Commit e3dd2d2

Browse files
author
Kevin J Walters
committed
Converting filter() to list comprehension with trailing if filter syntax based on review. adafruit#1185
1 parent 758280b commit e3dd2d2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

CLUE_Rock_Paper_Scissors/advanced/rps_comms.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -288,10 +288,10 @@ def broadcastAndReceive(radio,
288288
send_ad_rxs[addr_text] = True
289289

290290
# Pick out any Advertisements with an ack field with a value
291-
acks_thisaddr = list(filter(lambda adnb: hasattr(adnb[0], "ack")
292-
and isinstance(adnb[0].ack, int),
293-
adsnb_per_addr))
294-
# list() must have been run on acks_thisaddr to expand iterator
291+
acks_thisaddr = [adnb for adnb in adsnb_per_addr
292+
if hasattr(adnb[0], "ack")
293+
and isinstance(adnb[0].ack, int)]
294+
295295
if acks_thisaddr:
296296
seqs = [adnb[0].ack for adnb in acks_thisaddr]
297297
acks[addr_text] = seqs

0 commit comments

Comments
 (0)