This repository was archived by the owner on Sep 30, 2019. It is now read-only.
Fixes Github Issue 140 in Adafruit's repository #148
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change was made in response to a Github Issue #140
and a question on an Adafruit forum:
https://forums.adafruit.com/viewtopic.php?f=47&t=85731&p=432043&sid=584c7d7c80739693b81e5e0112c7c104#p432043)
The error comes from this line:
https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code/blob/master/Adafruit_LEDpixels/Adafruit_LEDpixels.py#L73
The error was caused by Python3 using floating point division when
Python2 would use integer division. The change uses a
//insteadof
/which forces both languages to use integer division.In Python2,
10 / 3gives3In Python3,
10 / 3gives3.333333After the change:
In Python2,
10 // 3gives3In Python3,
10 // 3gives3The output of the code is now the same, regardless of Python 2 vs. 3 as tested on my interpreters (2.7.6 and 3.5.1).