> + i = 0
[...]
> + for device_pref in prefs:
> + dpv = device_pref.split("|")
> + if dpv[0] == model[path][0]:
> + ''' If the current column is 1 or 2, it is a checkbox,
> + so transpose from bool to int '''
> + dpv[col_number] = parameter
> + prefs[i] = "%s|%s|%s|%s|%s" % (dpv[0], dpv[1], dpv[2], dpv[3], dpv[4])
> + i += 1
Because I'm a pedant, this could be rewritten as follows:
for i, device_pref in enumerate(prefs):
dpv = device_pref.split('|')
if dpv[0] == model[path][0]:
''' If the current column is 1 or 2, it is a checkbox,
so transpose from bool to int ''' dpv[col_number] = parameter
prefs[i] = '|'.join(dpv)
> + i = 0 pref.split( "|")
[...]
> + for device_pref in prefs:
> + dpv = device_
> + if dpv[0] == model[path][0]:
> + ''' If the current column is 1 or 2, it is a checkbox,
> + so transpose from bool to int '''
> + dpv[col_number] = parameter
> + prefs[i] = "%s|%s|%s|%s|%s" % (dpv[0], dpv[1], dpv[2], dpv[3], dpv[4])
> + i += 1
Because I'm a pedant, this could be rewritten as follows:
for i, device_pref in enumerate(prefs): pref.split( '|')
dpv[col_ number] = parameter
dpv = device_
if dpv[0] == model[path][0]:
''' If the current column is 1 or 2, it is a checkbox,
so transpose from bool to int '''
prefs[i] = '|'.join(dpv)