Project

General

Profile

Actions

Bug #9297

open

Py3: Remove unnecessary conversions to list

Added by Joseph Pizzi over 2 years ago. Updated about 1 year ago.

Status:
Feedback
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Start date:
08/21/2021
Due date:
% Done:

0%

Estimated time:
0.50 h
Chirp Version:
daily
Model affected:
Development
Platform:
Windows
Debug Log:
I read the instructions above:

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)))):@

Actions #1

Updated by Bernhard Hailer almost 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?

Actions #2

Updated by Joseph Pizzi almost 2 years ago

It resolves some of the cases. Just the ones in bitwise.py. As I remember, there were numerous others.

Joe Pizzi

Actions #3

Updated by Bernhard Hailer about 1 year ago

I assume this is covered in Chirp-next? Can we close the ticket?

Actions #4

Updated by Joseph Pizzi about 1 year ago

As of 20230124T1945, there are 43 instances of "list(range(" in the code.

Actions #5

Updated by Dan Smith about 1 year 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.

Actions #6

Updated by Joseph Pizzi about 1 year 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.

Actions

Also available in: Atom PDF