Open andyross opened 2 weeks ago
Split-out platform-layer PRs in #72768 #72769 and #72771
Please review that content there, I'll remove from here as they merge.
Stick a DNM on temporarily now that I see this has some +1's just so it doesn't merge before the dependee PRs
Noting here also: #72771 and #72768 still need some review love.
Rebase now that all the dependee PRs have merged. This is now a pure "new platform" PR that should be able to go in in isolation, presuming I didn't break anything in the rebase. Please re-review.
Spun on kconfig linting a bit, should be good now. The two pylint warnings are false positives: in that particular construct an iterate has no advantages.
Ping for merge? As mentioned, the pylint warning is contra-idiomatic (this is a bytewise copy over an mmap region, doing it with python enumerate() would be needlessly confusing). Also there's a doc build failure which seems to be a CI glitch?
To clarify the pylint issue, which provoked some discussion on discord, pylint has a test where it detects where you are doing "for i in range(len(some_iterable))
and using both the index i
and the element some_iterable[i]
. And it suggests that you use enumerate()
instead, which returns both.
Which is all well and good for the typical lists and dics with which the authors assumed it would be used. But in the cases it's flagging I'm iterating into two arrays (bytes and mmap objects) with the same index, and the asymmetry is confusing and weird. It wants to turn a trivially obvious bytewise copy that looks like this:
for i in range(len(input)):
output[i] = input[i]
into this asymmetric silliness, which obscures the actual operation that's happening:
for i, elem in enumerate(input):
output[i] = elem
It's just an inappropriate warning. In fact it's not even at "[W]arning" level, it's a "[C]onvention" message, asking me to "consider" using the alternative construction. And I did consider it! And I won't, because it's silly.
Maybe @nashif?
This is getting hot again. Rebase, update for changes and push again. Will split out the early patches as separate PRs while this is in review.