I have a for loop in which I use the iterator always in the same manner, like this
for dict in mylist:
var = dict['prop']
var2 = f( dict['prop'] )
...
This is clumsy. The only alternatives I can think of:
- local variable
- wrapping the mylist in a list comprehension. But that seems overkill and is probably inefficient
Any better way?
var, var2 = dict['prop'], f(dict['prop'])
– vaultah 1 hour agodict['prop']
). Perhaps show us more of your code? – NPE 1 hour ago