KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Just noticed that there is no function in Python to remove an item in a list by index, to be used while chaining . For instance, I am looking for something like this: another_list = list_of_items.remove[item-index] instead of del list_of_items[item_index] Since, remove(item_in_list) returns the list after removing the item_in_list ; I wonder why a similar function for index is left out. It seems very obvious and trivial to have been included, feels there is a reason to skip it. Any thoughts on why such a function is unavailable? ----- EDIT ------- list_of_items.pop(item_at_index) is not suitable as it doesn't return the list without the specific item to remove, hence can't be used to chain. (As per the Docs: L.pop([index]) -> item -- remove and return item at index )
Tags (comma-separated)
Save Edits
Cancel