list.insert() returns None because the list is altered in-place. You also don't want to share the same list object, you'll have to create copies of the list:
def f(j, ls):
output = [ls[:] for _ in xrange(len(ls) + 1)]
for i, sublist in enumerate(output):
output[i].insert(i, j)
return output
You also could use slicing to produce new sublists with the extra element 'inserted' through concatenation; this then gives you one-liner list comprehension:
def f(j, ls):
return [ls[:i] + [j] + ls[i:] for i in xrange(len(ls) + 1)]
Demo:
>>> def f(j, ls):
... output = [ls[:] for _ in xrange(len(ls) + 1)]
... for i, sublist in enumerate(output):
... output[i].insert(i, j)
... return output
...
>>> f('k', range(4))
[['k', 0, 1, 2, 3], [0, 'k', 1, 2, 3], [0, 1, 'k', 2, 3], [0, 1, 2, 'k', 3], [0, 1, 2, 3, 'k']]
>>> def f(j, ls):
... return [ls[:i] + [j] + ls[i:] for i in xrange(len(ls) + 1)]
...
>>> f('k', range(4))
[['k', 0, 1, 2, 3], [0, 'k', 1, 2, 3], [0, 1, 'k', 2, 3], [0, 1, 2, 'k', 3], [0, 1, 2, 3, 'k']]
[None]sublists.list.insert, see what it returns.