44import atexit
55
66
7+ try :
8+ xrange (0 )
9+ except NameError :
10+ xrange = range
11+
12+
713def Color (red , green , blue , white = 0 ):
814 """Convert the provided red, green, blue color to a 24-bit color value.
915 Each color component should be a value 0-255 where 0 is the lowest intensity
@@ -27,7 +33,7 @@ def __getitem__(self, pos):
2733 # Handle if a slice of positions are passed in by grabbing all the values
2834 # and returning them in a list.
2935 if isinstance (pos , slice ):
30- return [ws .ws2811_led_get (self .channel , n ) for n in range ( pos .indices (self .size ))]
36+ return [ws .ws2811_led_get (self .channel , n ) for n in xrange ( * pos .indices (self .size ))]
3137 # Else assume the passed in value is a number to the position.
3238 else :
3339 return ws .ws2811_led_get (self .channel , pos )
@@ -40,7 +46,7 @@ def __setitem__(self, pos, value):
4046 # LED data values to the provided values.
4147 if isinstance (pos , slice ):
4248 index = 0
43- for n in range ( pos .indices (self .size )):
49+ for n in xrange ( * pos .indices (self .size )):
4450 ws .ws2811_led_set (self .channel , n , value [index ])
4551 index += 1
4652 # Else assume the passed in value is a number to the position.
0 commit comments