A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2000-February/002037.html below:

[Python-Dev] Set data type (addendum)

[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




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4