The easiest way to initialize a large number of variables
Suppose you are given a large number of variables that need to be initialized to None. A naive way to do it is to count the number of variables on the left and create a list with the same size on the right:
a, b, c, d, e, f, g, h, i, j = [None]*10
Apart from variables, is there a way to do this? If you use this pattern a lot, you might need to count the number of variables.
+3
source to share