From: Donald A. <as...@tr...> - 2010-05-19 09:42:38
|
Kevin Walzer <kw...@co...> writes: > Python supports this functionality out of the box: > > list.remove(x) > > where x is the first list index whose value equals X. which is nothing at all like the [lremove] proposed in this TIP! Removal by value ("value equals X") appears to be what previous implementations of [lremove] do already. list.remove removes a single element, which is already handled, errr, handily by [lreplace]. > Given that Tcl supports every other kind of list operation, the lack of > a straightforward method for removing list items has always puzzled me. [lreplace]. > set list [lreplace $list [lsearch $list "item"] [lsearch $list "item"] So I take it you would prefer a different [lremove] TIP that performs the [lsearch] internally, rather than this TIP that uses indices. -- Donald Arseneau as...@tr... |