- Why doesn't the function
xmodify the contents of the list that is passed to it? - How can I change the MWE so that
xdoes modify the contents of the list that is passed to it?
>>> def x(mylist):
... mylist = [ x for x in mylist if x > 5 ]
...
>>> foo = [1,2,3,4,5,6,7,8,9,10]
>>> x(foo)
>>> print foo
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
mylist =makesmylistpoint to a different list.