random.shuffle(x) doesn't return anything, it just rearranges the entries in x, so that's why I defined shuffle(y), even though it shouldn't really be necessary.
def gen_pop(x):
def shuffle(y):
random.shuffle(y)
return y
population=[]
while len(population)<popsize:
a=shuffle(x)
print a
population.append(a)
return population
x=[[7,9],[4,5],[1,1]] and this code returns
[[1, 1], [4, 5], [7, 9]]
[[1, 1], [4, 5], [7, 9]]
[[1, 1], [7, 9], [4, 5]]
[[1, 1], [7, 9], [4, 5]]
[[7, 9], [1, 1], [4, 5]]
[[1, 1], [4, 5], [7, 9]]
[[1, 1], [4, 5], [7, 9]]
[[1, 1], [4, 5], [7, 9]]
[[4, 5], [7, 9], [1, 1]]
[[7, 9], [4, 5], [1, 1]]
[[[7, 9], [4, 5], [1, 1]], [[7, 9], [4, 5], [1, 1]], [[7, 9], [4, 5], [1, 1]], [[7, 9], [4, 5], [1, 1]], [[7, 9], [4, 5], [1, 1]], [[7, 9], [4, 5], [1, 1]], [[7, 9], [4, 5], [1, 1]], [[7, 9], [4, 5], [1, 1]], [[7, 9], [4, 5], [1, 1]], [[7, 9], [4, 5], [1, 1]]]
so 'a' is getting shuffled before the print, but for some reason population just gets filled with identical copies of the original order of x