[Python-Dev] Set data type (addendum)
Ka-Ping Yee
ping@lfw.org
Thu, 3 Feb 2000 19:27:36 -0600 (EST)
On Thu, 3 Feb 2000, Ka-Ping Yee wrote:
>
> In short, sets get
>
> append, extend, remove # from lists
> clear, copy # from dictionaries
I picked append() rather than insert() since list.insert()
takes two arguments, although you could also argue that
"insert" makes more sense since the item being added
doesn't "go at the end".
> and the operators
>
> &, |, in, <=, >=, <, >, ==
Oh! I forgot one! Of course, sets should also support "-":
>>> s = {1, 2, 3, 4}
>>> t = {2, 4, 5}
>>> s - t
{3, 1}
The "+" operator could do the same as "|".
-- ?!ng