why does list's .remove() does not return an object?

Ned Batchelder ned at nedbatchelder.com
Thu May 17 12:37:25 EDT 2018


On 5/17/18 12:28 PM, Dan Strohl via Python-list wrote:
> 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
>>
> Though I don’t know what the OP was specifically looking for I could see a benefit to returning the item deleted.

Notice that this is not the thing the OP wanted returned.  I believe 
they are looking to return the list, not the item.

--Ned.



More information about the Python-list mailing list