Bug #9297
openPy3: Remove unnecessary conversions to list
0%
Description
Dispite 2to3's xrange converter, not all instances of range need to be wrapped in conversion to list.
For example,
@for i in reverse(range(0, len(bcd_array))):@
is just fine without the range being placed in a list.
2to3 replaces the above line with,
@for i in reversed(list(range(0,l len(bcd_array)))):@
Updated by Bernhard Hailer over 2 years ago
- Status changed from New to Feedback
- Model affected changed from (All models) to Development
Does the applied patch resolve the ticket? Can we close it?
Updated by Joseph Pizzi over 2 years ago
It resolves some of the cases. Just the ones in bitwise.py. As I remember, there were numerous others.
Joe Pizzi
Updated by Bernhard Hailer almost 2 years ago
I assume this is covered in Chirp-next? Can we close the ticket?
Updated by Joseph Pizzi almost 2 years ago
As of 20230124T1945, there are 43 instances of "list(range(" in the code.
Updated by Dan Smith almost 2 years ago
Are you planning to fix them? If so, great, but if not, this can probably be closed. Optimizations are cool, but I don't think a bug is needed if it's not being worked by anyone.
Updated by Joseph Pizzi almost 2 years ago
I just started to do it, but then thought about when we could remove it and when it was necessary. Since I wasn't able to answer that question, let's just leave them.