GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||
GeezerVison is showing github.com — Added support for bytes in sliced __setitem__ by hl037 · Pull Request #42 · python-intelhex/intelhex Conversation
Member
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
|
There was an error while loading. Please reload this page.
|
I think you can omit the isinstance check at all. It's not really needed if we want to be as generic as possible. In fact all that code really need is some iterable object that provide integers. So you can simply change check to something like:
and that will cover much more use cases. I just want you to make a proper test case when regular string is passed (e.g. "foo" not a byte string). |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Hello, sorry for the long response time, I was quite busy this summer :) So, I did not removed all the checks, but I did something that should handle all the cases with minimal tradeoff on performances. In the case of a bytes or byte array, no conversions / checks occurs on the data. On list and tuples, only value check (int + 0<=x<=255), and on other types, I try to convert to bytes that does the necessary check itself while providing a getitem ready container. I added my name on the authors and also added a news entry as you suggested. I also let myself increase the version number since it seems to be the way it is, let me know if I should change anything else :) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.