Convert the output of range() to list

In Python 2 the range() function returns a list [1].
In Python 3 the range function returns a range type [2] which
represents an immutable sequence of numbers [3].

[1] https://docs.python.org/2.7/library/functions.html#range
[2] https://docs.python.org/3/library/functions.html#func-range
[3] https://docs.python.org/3/library/stdtypes.html#typesseq-range
This commit is contained in:
Radostin Stoyanov 2017-10-11 12:35:57 +01:00 committed by Cole Robinson
parent 5854b7bb17
commit 4d9c6141dd
4 changed files with 5 additions and 5 deletions

View File

@ -3228,7 +3228,7 @@ class vmmDetails(vmmGObjectUI):
for dev in self.vm.get_panic_devices(): for dev in self.vm.get_panic_devices():
update_hwlist(HW_LIST_TYPE_PANIC, dev) update_hwlist(HW_LIST_TYPE_PANIC, dev)
devs = range(len(hw_list_model)) devs = list(range(len(hw_list_model)))
devs.reverse() devs.reverse()
for i in devs: for i in devs:
_iter = hw_list_model.iter_nth_child(None, i) _iter = hw_list_model.iter_nth_child(None, i)

View File

@ -43,11 +43,11 @@ EDIT_NET_IDS = (
EDIT_NET_NAME, EDIT_NET_NAME,
EDIT_NET_AUTOSTART, EDIT_NET_AUTOSTART,
EDIT_NET_QOS, EDIT_NET_QOS,
) = range(3) ) = list(range(3))
EDIT_INTERFACE_IDS = ( EDIT_INTERFACE_IDS = (
EDIT_INTERFACE_STARTMODE, EDIT_INTERFACE_STARTMODE,
) = range(200, 201) ) = list(range(200, 201))
class vmmHost(vmmGObjectUI): class vmmHost(vmmGObjectUI):

View File

@ -36,7 +36,7 @@ from .createvol import vmmCreateVolume
EDIT_POOL_IDS = ( EDIT_POOL_IDS = (
EDIT_POOL_NAME, EDIT_POOL_NAME,
EDIT_POOL_AUTOSTART, EDIT_POOL_AUTOSTART,
) = range(2) ) = list(range(2))
VOL_NUM_COLUMNS = 7 VOL_NUM_COLUMNS = 7
(VOL_COLUMN_KEY, (VOL_COLUMN_KEY,

View File

@ -144,7 +144,7 @@ def generate_name(base, collision_cb, suffix="", lib_collision=True,
else: else:
return collision_cb(tryname) return collision_cb(tryname)
numrange = range(start_num, start_num + 100000) numrange = list(range(start_num, start_num + 100000))
if not force_num: if not force_num:
numrange = [None] + numrange numrange = [None] + numrange