In Python 3.x, I'm calling a function rand_foo()
which returns some random stuff each time being called. I wish to store the sequence of random results into a list. I'm using the following construct:
r = [ rand_foo() for i in range(10) ]
Now my PyCharm 3.0 IDE keeps warning: Local variable 'i' value is not used
.
Is there an elegant way of removing the unnecessary variable? Indeed, in some cases, I could use itertools.repeat()
or something like 10*[value]
, which, however, cannot be applied to my example above.