Skip to content

Commit 50bca22

Browse files
committed
add a note about why the code is not using list comprehensions and extra variables for speed
1 parent 9d661b2 commit 50bca22

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

adafruit_led_animation/color.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ def calculate_intensity(color, intensity=1.0):
7373
:param color: color value (tuple, list or int)
7474
:return: color
7575
"""
76+
# Note: This code intentionally avoids list comprehensions and intermediate variables
77+
# for an approximately 2x performance gain.
7678
if isinstance(color, int):
7779
return (
7880
(int((color & 0xFF0000) * intensity) & 0xFF0000)

0 commit comments

Comments
 (0)