On 5/17/18 4:23 AM, Abdur-Rahmaan Janhangeer wrote:
if then a more convenient way might be found to naturally remove and
return the list
maybe it was not included as one might want to remove the list only
x = 
as opposed to
x = 
new_list = x
i was looking for like
x = 
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?
(PS: bottom-posting (adding your response below the text you are
responding to) will make the conversation easier to follow...)
ps. list is was demo illustrative var
On Thu, 17 May 2018, 07:01 Ned Batchelder, <n...@nedbatchelder.com
On 5/16/18 10:41 PM, Abdur-Rahmaan Janhangeer wrote:
> why is x = list.remove(elem) not return the list?
Methods in Python usually do one of two things: 1) mutate the
return None; or 2) leave the object alone and return a new
helps make it clear which methods mutate and which don't. Since
mutates the list, it returns None.