Hoi,
Is er geen '-' (__sub__) operator voor lists??

Je kan wel twee lists optellen, maar niet aftrekken?

Bijv.
foo = ["bla", "blie", "blo", "blub"]
bar = ["blie", "blub"]

foo + bar = ["bla", "blie", "blo", "blub", "blie", "blub"]

foo - bar = TypeError: unsupported operand type(s) for -: 'list' and 'list'

Ik doe nu zoiets als:
    result = [ i for i in foo if i not in bar ]
    result = ["bla",  "blo"]


Wat ikzelf nogal cryptisch vindt...

Iets voor een PEP? Of is dat overdreven?


--
               Andre van der Vlies <[EMAIL PROTECTED]>
               Certifiable Linux/UNIX engineer (CLUE)
               Homepage: http://vandervlies.xs4all.nl/~andre
Key fingerprint = 397C 7479 67DB 9306 23DC B423 7B58 CD5A 6EFF 5CF8
--
    "Programming isn't a craft, it's an art."
    ()  ascii ribbon campaign - against html e-mail
    /\                        - against microsoft attachments
                              ^[^#]
--

_______________________________________________
Python-nl mailing list
Python-nl@python.org
http://mail.python.org/mailman/listinfo/python-nl

Antwoord per e-mail aan