On 2018-05-17 11:26 AM, Abdur-Rahmaan Janhangeer wrote: > I don't understand what this would return? x? You already have x. Is it > meant to make a copy? x has been mutated, so I don't understand the benefit > of making a copy of the 1-less x. Can you elaborate on the problem you are > trying to solve? > > --Ned. > > > assignment to another var > You already have access to the list before removal, the list after removal and the element to be removed.
Do need a copy of the list before removing x? >>> old_list = list[:] >>> list.remove(x) Do you need the list after removing x? >>> list.remove(x) # list is the modified list Do you need x? >>> list.remove(x) # x is x What else would need to be assigned to another var? -- https://mail.python.org/mailman/listinfo/python-list