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

Tobiah toby at tobiah.org
Thu May 17 15:34:03 EDT 2018


On 05/17/2018 09:25 AM, Ned Batchelder wrote:
> On 5/17/18 11:57 AM, Abdur-Rahmaan Janhangeer wrote:
>> x = [0,1]
>> x.remove(0)
>> new_list = x

Just call the original list 'new_list' to begin with.

   new_list = [0, 1]
   new_list.remove(0)


There you are!



More information about the Python-list mailing list