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 object and return None; or 2) leave the object alone and return a new object.  This helps make it clear which methods mutate and which don't.  Since .remove mutates the list, it returns None.

--Ned.
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to