⬅︎ Back to Case insensitive list remove call
See the test cases on http://www.peterbe.com/plog/case-insensitive-list-remove-call-part-ii/iremove.pyand notice how unfortunately few of them are long lists. If they were really really long, a O(log n) method like this might beat the list comprehension one.
prefer the list comp personally, but for idx, item in enumerate(list_): if ss(item) == element: del list_[idx] break # is it a bit more efficient in worst case.
Comment
See the test cases on http://www.peterbe.com/plog/case-insensitive-list-remove-call-part-ii/iremove.py
and notice how unfortunately few of them are long lists. If they were really really long, a O(log n) method like this might beat the list comprehension one.
Parent comment
prefer the list comp personally, but for idx, item in enumerate(list_): if ss(item) == element: del list_[idx] break # is it a bit more efficient in worst case.