list.without()?

Magnus L. Hetland mlh at vier.idi.ntnu.no
Mon Nov 15 19:03:44 EST 1999


Hi!

Is there a function or method in the standard language that can
non-destructively return a list without a specified element? Would it
be possible to add it as a method to lists?

i.e:

# pseudocode

class list:
    def without(self,element):
        temp = self[:]
        temp.remove(element)
        return temp

It might be useful - and sure beats using a temp-variable ;)

--

  Magnus          Echelon jamming noise:
  Lie             FBI CIA NSA Handgun Assault Bomb Drug Terrorism
  Hetland         Special Forces Delta Force AK47 Hillary Clinton 




More information about the Python-list mailing list