Project

General

Profile

Actions

Bug #9297

open

Py3: Remove unnecessary conversions to list

Added by Joseph Pizzi over 1 year ago. Updated 4 days ago.

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

0%

Estimated time:
0.50 h
Chirp Version:
daily
Model affected:
Development
Platform:
Windows

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 9 months 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 9 months 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 4 days ago

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

Actions #4

Updated by Joseph Pizzi 4 days ago

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

Actions #5

Updated by Dan Smith 4 days 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 4 days 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