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
buckbaskin wants to merge 1 commit intoadafruit:masterfrom
Closed
Fixes Github Issue 140 in Adafruit's repository#148buckbaskin wants to merge 1 commit intoadafruit:masterfrom
buckbaskin wants to merge 1 commit intoadafruit:masterfrom
Conversation
The error was caused by Python3 using floating point division when Python2 would use integer division. The change uses a // instead of / which forces both languages to use integer division. In Python2, 10 / 3 gives 3 In Python3, 10 / 3 gives 3.333333 After the change: In Python2, 10 // 3 gives 3 In Python3, 10 // 3 gives 3
Member
|
This library has been deprecated in favor of our python3 Blinka library. We have replaced all of the libraries that use this repo with CircuitPython libraries that are Python3 compatible, and support a wide variety of single board/linux computers! Visit https://circuitpython.org/blinka for more information CircuitPython has support for almost 200 different drivers, and a as well as FT232H support for Mac/Win/Linux! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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).