Fredrik Lundh fredrik at
Tue Nov 16 10:59:32 CET 1999

Magnus L. Hetland <mlh at> wrote:
> Why on *earth* would you use a while/try/break-combination?

maybe because the meaning of "without a
specified element" is unclear.  mike's version
guarantees that:

    assert element not in list

never fails, while your version behaves just
like "remove" -- if there are several instances
of an element value, only the first one is

    count = list.count(element)
    assert count == 0 or list.count(element) == count-1

in either case, adding "without" (like remove, but
returns a new list) strikes me as being even more
contrived than earlier proposals like "sorted" (like
sort, but returns a new list), etc.


More information about the Python-list mailing list