-
Notifications
You must be signed in to change notification settings - Fork 38
(#9) change __getitem__ to use self._n instead of self._buf // 4 #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- self._buf would be incorrect if there are headers - adafruit#9
More context
so if you had one dotstar, length of
|
Tested this manually with the pycon Gemma M0 ✅
(Test with current master of this library) code.py (modified from the default pycon open session file) is
This prints
Compared to this from CPython
With this PR's changes
This matches the behavior of standard slicing, so I think this change is ✅ Note that the IndexError description doesn't seem to get bubbled up in circuitpython, but I think that should be a separate issue. |
@tannewt Ready for review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Looks much simpler!
Updating https://github.com/adafruit/Adafruit_CircuitPython_DotStar to 1.2.0 from 1.1.4: > Merge pull request adafruit/Adafruit_CircuitPython_DotStar#20 from mcscope/patch-1 > Merge pull request adafruit/Adafruit_CircuitPython_DotStar#19 from mcscope/advanced_dotstar > Merge pull request adafruit/Adafruit_CircuitPython_DotStar#18 from mcscope/color_orders > Merge pull request adafruit/Adafruit_CircuitPython_DotStar#17 from margaret/consistent_get_set > Merge pull request adafruit/Adafruit_CircuitPython_DotStar#14 from sommersoft/new_docs
__setitem__
useslen(self)
, make this consistent with__getitem__
and useself._n
directly)