> ## Documentation Index
> Fetch the complete documentation index at: https://site.aspect.build/llms.txt
> Use this file to discover all available pages before exploring further.

# Set

`function` **set.add**

<div class="code-block mt-5 mb-8 not-prose rounded-2xl relative group text-gray-950 dark:text-gray-50 codeblock-light border border-gray-950/10 dark:border-white/10 dark:twoslash-dark bg-transparent dark:bg-transparent" numberoflines="10" language="python">
  <div class="w-0 min-w-full max-w-full py-3.5 px-4 h-full dark:bg-codeblock relative text-sm leading-6 children:!my-0 children:!shadow-none children:!bg-transparent transition-[height] duration-300 ease-in-out [&_*]:ring-0 [&_*]:outline-none [&_*]:focus:ring-0 [&_*]:focus:outline-none [&_pre>code]:pr-[3rem] [&_pre>code>span.line-highlight]:min-w-[calc(100%+3rem)] [&_pre>code>span.line-diff]:min-w-[calc(100%+3rem)] rounded-2xl bg-white overflow-x-auto scrollbar-thin scrollbar-thumb-rounded scrollbar-thumb-black/15 hover:scrollbar-thumb-black/20 active:scrollbar-thumb-black/20 dark:scrollbar-thumb-white/20 dark:hover:scrollbar-thumb-white/25 dark:active:scrollbar-thumb-white/25" data-component-part="code-block-root" tabindex="0">
    <div class="font-mono whitespace-pre leading-6">
      <pre class="shiki shiki-themes github-light-default dark-plus" language="python">
        <code language="python">
          <span class="source python"><span class="meta function python"><span class="storage type function python">def</span> <span class="entity name function python"><span class="meta generic-name python">set</span></span>.<span class="entity name function python"><span class="meta generic-name python">add</span></span></span><span class="meta function parameters python"><span class="punctuation section parameters begin python">(</span></span><span class="meta function parameters python">
          <span class="variable parameter python">value</span></span><span class="meta function parameters annotation python"><span class="punctuation separator annotation parameter python">:</span> <a href="/axl/types/typing">typing</a><span class="punctuation accessor dot python">.</span><a href="/axl/types/typing">Any</a></span><span class="meta function parameters python"><span class="punctuation separator parameters python">,</span>
          /
          <span class="punctuation section parameters end python">)</span></span><span class="meta function python"> </span><span class="meta function annotation return python"><span class="punctuation separator annotation return python">-></span> <a href="/axl/types">None</a></span></span>
        </code>
      </pre>
    </div>
  </div>
</div>

Add an item to the set. `# starlark::assert::is_true(r#" x = set([1, 2, 3]) x.add(4) x == set([1, 2, 3, 4]) # "#);`

`function` **set.clear**

<div class="code-block mt-5 mb-8 not-prose rounded-2xl relative group text-gray-950 dark:text-gray-50 codeblock-light border border-gray-950/10 dark:border-white/10 dark:twoslash-dark bg-transparent dark:bg-transparent" numberoflines="10" language="python">
  <div class="w-0 min-w-full max-w-full py-3.5 px-4 h-full dark:bg-codeblock relative text-sm leading-6 children:!my-0 children:!shadow-none children:!bg-transparent transition-[height] duration-300 ease-in-out [&_*]:ring-0 [&_*]:outline-none [&_*]:focus:ring-0 [&_*]:focus:outline-none [&_pre>code]:pr-[3rem] [&_pre>code>span.line-highlight]:min-w-[calc(100%+3rem)] [&_pre>code>span.line-diff]:min-w-[calc(100%+3rem)] rounded-2xl bg-white overflow-x-auto scrollbar-thin scrollbar-thumb-rounded scrollbar-thumb-black/15 hover:scrollbar-thumb-black/20 active:scrollbar-thumb-black/20 dark:scrollbar-thumb-white/20 dark:hover:scrollbar-thumb-white/25 dark:active:scrollbar-thumb-white/25" data-component-part="code-block-root" tabindex="0">
    <div class="font-mono whitespace-pre leading-6">
      <pre class="shiki shiki-themes github-light-default dark-plus" language="python">
        <code language="python">
          <span class="source python"><span class="meta function python"><span class="storage type function python">def</span> <span class="entity name function python"><span class="meta generic-name python">set</span></span>.<span class="entity name function python"><span class="meta generic-name python">clear</span></span></span><span class="meta function parameters python"><span class="punctuation section parameters begin python">(</span></span><span class="meta function parameters python"><span class="punctuation section parameters end python">)</span></span><span class="meta function python"> </span><span class="meta function annotation return python"><span class="punctuation separator annotation return python">-></span> <a href="/axl/types">None</a></span></span>
        </code>
      </pre>
    </div>
  </div>
</div>

`function` **set.difference**

<div class="code-block mt-5 mb-8 not-prose rounded-2xl relative group text-gray-950 dark:text-gray-50 codeblock-light border border-gray-950/10 dark:border-white/10 dark:twoslash-dark bg-transparent dark:bg-transparent" numberoflines="10" language="python">
  <div class="w-0 min-w-full max-w-full py-3.5 px-4 h-full dark:bg-codeblock relative text-sm leading-6 children:!my-0 children:!shadow-none children:!bg-transparent transition-[height] duration-300 ease-in-out [&_*]:ring-0 [&_*]:outline-none [&_*]:focus:ring-0 [&_*]:focus:outline-none [&_pre>code]:pr-[3rem] [&_pre>code>span.line-highlight]:min-w-[calc(100%+3rem)] [&_pre>code>span.line-diff]:min-w-[calc(100%+3rem)] rounded-2xl bg-white overflow-x-auto scrollbar-thin scrollbar-thumb-rounded scrollbar-thumb-black/15 hover:scrollbar-thumb-black/20 active:scrollbar-thumb-black/20 dark:scrollbar-thumb-white/20 dark:hover:scrollbar-thumb-white/25 dark:active:scrollbar-thumb-white/25" data-component-part="code-block-root" tabindex="0">
    <div class="font-mono whitespace-pre leading-6">
      <pre class="shiki shiki-themes github-light-default dark-plus" language="python">
        <code language="python">
          <span class="source python"><span class="meta function python"><span class="storage type function python">def</span> <span class="entity name function python"><span class="meta generic-name python">set</span></span>.<span class="entity name function python"><span class="meta generic-name python">difference</span></span></span><span class="meta function parameters python"><span class="punctuation section parameters begin python">(</span></span><span class="meta function parameters python">
          <span class="variable parameter python">other</span></span><span class="meta function parameters annotation python"><span class="punctuation separator annotation parameter python">:</span> <a href="/axl/types/typing">typing</a><span class="punctuation accessor dot python">.</span><a href="/axl/types/typing">Iterable</a></span><span class="meta function parameters python"><span class="punctuation separator parameters python">,</span>
          /
          <span class="punctuation section parameters end python">)</span></span><span class="meta function python"> </span><span class="meta function annotation return python"><span class="punctuation separator annotation return python">-></span> <a href="/axl/types/set">set</a><span class="meta item-access python"><span class="punctuation section brackets begin python">\[</span></span><span class="meta item-access arguments python"><a href="/axl/types/typing">typing</a><span class="punctuation accessor dot python">.</span><a href="/axl/types/typing">Any</a></span><span class="meta item-access python"><span class="punctuation section brackets end python">]</span></span></span></span>
        </code>
      </pre>
    </div>
  </div>
</div>

Returns a new set with elements unique the set when compared to the specified iterable. `# starlark::assert::is_true(r#" x = set([1, 2, 3]) y = [3, 4, 5] x.difference(y) == set([1, 2]) # "#);`

`function` **set.discard**

<div class="code-block mt-5 mb-8 not-prose rounded-2xl relative group text-gray-950 dark:text-gray-50 codeblock-light border border-gray-950/10 dark:border-white/10 dark:twoslash-dark bg-transparent dark:bg-transparent" numberoflines="10" language="python">
  <div class="w-0 min-w-full max-w-full py-3.5 px-4 h-full dark:bg-codeblock relative text-sm leading-6 children:!my-0 children:!shadow-none children:!bg-transparent transition-[height] duration-300 ease-in-out [&_*]:ring-0 [&_*]:outline-none [&_*]:focus:ring-0 [&_*]:focus:outline-none [&_pre>code]:pr-[3rem] [&_pre>code>span.line-highlight]:min-w-[calc(100%+3rem)] [&_pre>code>span.line-diff]:min-w-[calc(100%+3rem)] rounded-2xl bg-white overflow-x-auto scrollbar-thin scrollbar-thumb-rounded scrollbar-thumb-black/15 hover:scrollbar-thumb-black/20 active:scrollbar-thumb-black/20 dark:scrollbar-thumb-white/20 dark:hover:scrollbar-thumb-white/25 dark:active:scrollbar-thumb-white/25" data-component-part="code-block-root" tabindex="0">
    <div class="font-mono whitespace-pre leading-6">
      <pre class="shiki shiki-themes github-light-default dark-plus" language="python">
        <code language="python">
          <span class="source python"><span class="meta function python"><span class="storage type function python">def</span> <span class="entity name function python"><span class="meta generic-name python">set</span></span>.<span class="entity name function python"><span class="meta generic-name python">discard</span></span></span><span class="meta function parameters python"><span class="punctuation section parameters begin python">(</span></span><span class="meta function parameters python">
          <span class="variable parameter python">value</span></span><span class="meta function parameters annotation python"><span class="punctuation separator annotation parameter python">:</span> <a href="/axl/types/typing">typing</a><span class="punctuation accessor dot python">.</span><a href="/axl/types/typing">Any</a></span><span class="meta function parameters python"><span class="punctuation separator parameters python">,</span>
          /
          <span class="punctuation section parameters end python">)</span></span><span class="meta function python"> </span><span class="meta function annotation return python"><span class="punctuation separator annotation return python">-></span> <a href="/axl/types">None</a></span></span>
        </code>
      </pre>
    </div>
  </div>
</div>

Remove the item from the set. It does nothing if there is no such item.

`discard` fails if the key is unhashable or if the dictionary is
frozen.
Time complexity of this operation is *O(N)* where *N* is the number of entries in the set.

```
x = set([1, 2, 3])
x.discard(2)
x == set([1, 3])
```

A subsequent call to `x.discard(2)` would do nothing.

```
x = set([1, 2, 3])
x.discard(2)
x.discard(2)
x == set([1, 3])
```

`function` **set.intersection**

<div class="code-block mt-5 mb-8 not-prose rounded-2xl relative group text-gray-950 dark:text-gray-50 codeblock-light border border-gray-950/10 dark:border-white/10 dark:twoslash-dark bg-transparent dark:bg-transparent" numberoflines="10" language="python">
  <div class="w-0 min-w-full max-w-full py-3.5 px-4 h-full dark:bg-codeblock relative text-sm leading-6 children:!my-0 children:!shadow-none children:!bg-transparent transition-[height] duration-300 ease-in-out [&_*]:ring-0 [&_*]:outline-none [&_*]:focus:ring-0 [&_*]:focus:outline-none [&_pre>code]:pr-[3rem] [&_pre>code>span.line-highlight]:min-w-[calc(100%+3rem)] [&_pre>code>span.line-diff]:min-w-[calc(100%+3rem)] rounded-2xl bg-white overflow-x-auto scrollbar-thin scrollbar-thumb-rounded scrollbar-thumb-black/15 hover:scrollbar-thumb-black/20 active:scrollbar-thumb-black/20 dark:scrollbar-thumb-white/20 dark:hover:scrollbar-thumb-white/25 dark:active:scrollbar-thumb-white/25" data-component-part="code-block-root" tabindex="0">
    <div class="font-mono whitespace-pre leading-6">
      <pre class="shiki shiki-themes github-light-default dark-plus" language="python">
        <code language="python">
          <span class="source python"><span class="meta function python"><span class="storage type function python">def</span> <span class="entity name function python"><span class="meta generic-name python">set</span></span>.<span class="entity name function python"><span class="meta generic-name python">intersection</span></span></span><span class="meta function parameters python"><span class="punctuation section parameters begin python">(</span></span><span class="meta function parameters python">
          <span class="variable parameter python">other</span></span><span class="meta function parameters annotation python"><span class="punctuation separator annotation parameter python">:</span> <a href="/axl/types/typing">typing</a><span class="punctuation accessor dot python">.</span><a href="/axl/types/typing">Iterable</a></span><span class="meta function parameters python"><span class="punctuation separator parameters python">,</span>
          /
          <span class="punctuation section parameters end python">)</span></span><span class="meta function python"> </span><span class="meta function annotation return python"><span class="punctuation separator annotation return python">-></span> <a href="/axl/types/set">set</a><span class="meta item-access python"><span class="punctuation section brackets begin python">\[</span></span><span class="meta item-access arguments python"><a href="/axl/types/typing">typing</a><span class="punctuation accessor dot python">.</span><a href="/axl/types/typing">Any</a></span><span class="meta item-access python"><span class="punctuation section brackets end python">]</span></span></span></span>
        </code>
      </pre>
    </div>
  </div>
</div>

Return a new set with elements common to the set and all others. Unlike Python does not support variable number of arguments. `# starlark::assert::is_true(r#" x = set([1, 2, 3]) y = [3, 4, 5] x.intersection(y) == set([3]) # "#);`

`function` **set.issubset**

<div class="code-block mt-5 mb-8 not-prose rounded-2xl relative group text-gray-950 dark:text-gray-50 codeblock-light border border-gray-950/10 dark:border-white/10 dark:twoslash-dark bg-transparent dark:bg-transparent" numberoflines="10" language="python">
  <div class="w-0 min-w-full max-w-full py-3.5 px-4 h-full dark:bg-codeblock relative text-sm leading-6 children:!my-0 children:!shadow-none children:!bg-transparent transition-[height] duration-300 ease-in-out [&_*]:ring-0 [&_*]:outline-none [&_*]:focus:ring-0 [&_*]:focus:outline-none [&_pre>code]:pr-[3rem] [&_pre>code>span.line-highlight]:min-w-[calc(100%+3rem)] [&_pre>code>span.line-diff]:min-w-[calc(100%+3rem)] rounded-2xl bg-white overflow-x-auto scrollbar-thin scrollbar-thumb-rounded scrollbar-thumb-black/15 hover:scrollbar-thumb-black/20 active:scrollbar-thumb-black/20 dark:scrollbar-thumb-white/20 dark:hover:scrollbar-thumb-white/25 dark:active:scrollbar-thumb-white/25" data-component-part="code-block-root" tabindex="0">
    <div class="font-mono whitespace-pre leading-6">
      <pre class="shiki shiki-themes github-light-default dark-plus" language="python">
        <code language="python">
          <span class="source python"><span class="meta function python"><span class="storage type function python">def</span> <span class="entity name function python"><span class="meta generic-name python">set</span></span>.<span class="entity name function python"><span class="meta generic-name python">issubset</span></span></span><span class="meta function parameters python"><span class="punctuation section parameters begin python">(</span></span><span class="meta function parameters python">
          <span class="variable parameter python">other</span></span><span class="meta function parameters annotation python"><span class="punctuation separator annotation parameter python">:</span> <a href="/axl/types/typing">typing</a><span class="punctuation accessor dot python">.</span><a href="/axl/types/typing">Iterable</a></span><span class="meta function parameters python"><span class="punctuation separator parameters python">,</span>
          /
          <span class="punctuation section parameters end python">)</span></span><span class="meta function python"> </span><span class="meta function annotation return python"><span class="punctuation separator annotation return python">-></span> <a href="/axl/types/bool">bool</a></span></span>
        </code>
      </pre>
    </div>
  </div>
</div>

Test whether every element in the set is in other iterable. `# starlark::assert::is_true(r#" x = set([1, 2, 3]) y = [3, 1, 2] x.issubset(y) # "#);`

`function` **set.issuperset**

<div class="code-block mt-5 mb-8 not-prose rounded-2xl relative group text-gray-950 dark:text-gray-50 codeblock-light border border-gray-950/10 dark:border-white/10 dark:twoslash-dark bg-transparent dark:bg-transparent" numberoflines="10" language="python">
  <div class="w-0 min-w-full max-w-full py-3.5 px-4 h-full dark:bg-codeblock relative text-sm leading-6 children:!my-0 children:!shadow-none children:!bg-transparent transition-[height] duration-300 ease-in-out [&_*]:ring-0 [&_*]:outline-none [&_*]:focus:ring-0 [&_*]:focus:outline-none [&_pre>code]:pr-[3rem] [&_pre>code>span.line-highlight]:min-w-[calc(100%+3rem)] [&_pre>code>span.line-diff]:min-w-[calc(100%+3rem)] rounded-2xl bg-white overflow-x-auto scrollbar-thin scrollbar-thumb-rounded scrollbar-thumb-black/15 hover:scrollbar-thumb-black/20 active:scrollbar-thumb-black/20 dark:scrollbar-thumb-white/20 dark:hover:scrollbar-thumb-white/25 dark:active:scrollbar-thumb-white/25" data-component-part="code-block-root" tabindex="0">
    <div class="font-mono whitespace-pre leading-6">
      <pre class="shiki shiki-themes github-light-default dark-plus" language="python">
        <code language="python">
          <span class="source python"><span class="meta function python"><span class="storage type function python">def</span> <span class="entity name function python"><span class="meta generic-name python">set</span></span>.<span class="entity name function python"><span class="meta generic-name python">issuperset</span></span></span><span class="meta function parameters python"><span class="punctuation section parameters begin python">(</span></span><span class="meta function parameters python">
          <span class="variable parameter python">other</span></span><span class="meta function parameters annotation python"><span class="punctuation separator annotation parameter python">:</span> <a href="/axl/types/typing">typing</a><span class="punctuation accessor dot python">.</span><a href="/axl/types/typing">Iterable</a></span><span class="meta function parameters python"><span class="punctuation separator parameters python">,</span>
          /
          <span class="punctuation section parameters end python">)</span></span><span class="meta function python"> </span><span class="meta function annotation return python"><span class="punctuation separator annotation return python">-></span> <a href="/axl/types/bool">bool</a></span></span>
        </code>
      </pre>
    </div>
  </div>
</div>

Test whether every element other iterable is in the set. `# starlark::assert::is_true(r#" x = set([1, 2, 3]) y = [1, 3] x.issuperset(y) == True # "#);`

`function` **set.pop**

<div class="code-block mt-5 mb-8 not-prose rounded-2xl relative group text-gray-950 dark:text-gray-50 codeblock-light border border-gray-950/10 dark:border-white/10 dark:twoslash-dark bg-transparent dark:bg-transparent" numberoflines="10" language="python">
  <div class="w-0 min-w-full max-w-full py-3.5 px-4 h-full dark:bg-codeblock relative text-sm leading-6 children:!my-0 children:!shadow-none children:!bg-transparent transition-[height] duration-300 ease-in-out [&_*]:ring-0 [&_*]:outline-none [&_*]:focus:ring-0 [&_*]:focus:outline-none [&_pre>code]:pr-[3rem] [&_pre>code>span.line-highlight]:min-w-[calc(100%+3rem)] [&_pre>code>span.line-diff]:min-w-[calc(100%+3rem)] rounded-2xl bg-white overflow-x-auto scrollbar-thin scrollbar-thumb-rounded scrollbar-thumb-black/15 hover:scrollbar-thumb-black/20 active:scrollbar-thumb-black/20 dark:scrollbar-thumb-white/20 dark:hover:scrollbar-thumb-white/25 dark:active:scrollbar-thumb-white/25" data-component-part="code-block-root" tabindex="0">
    <div class="font-mono whitespace-pre leading-6">
      <pre class="shiki shiki-themes github-light-default dark-plus" language="python">
        <code language="python">
          <span class="source python"><span class="meta function python"><span class="storage type function python">def</span> <span class="entity name function python"><span class="meta generic-name python">set</span></span>.<span class="entity name function python"><span class="meta generic-name python">pop</span></span></span><span class="meta function parameters python"><span class="punctuation section parameters begin python">(</span></span><span class="meta function parameters python"><span class="punctuation section parameters end python">)</span></span><span class="meta function python"> </span><span class="meta function annotation return python"><span class="punctuation separator annotation return python">-></span> <a href="/axl/types/typing">typing</a><span class="punctuation accessor dot python">.</span><a href="/axl/types/typing">Any</a></span></span>
        </code>
      </pre>
    </div>
  </div>
</div>

Removes and returns the **last** element of a set.

`S.pop()` removes and returns the last element of the set S.

`pop` fails if the set is empty, or if the set is frozen or has active iterators.
Time complexity of this operation is *O(1)*.

```
x = set([1, 2, 3])
x.pop() == 3
x.pop() == 2
x == set([1])
```

`function` **set.remove**

<div class="code-block mt-5 mb-8 not-prose rounded-2xl relative group text-gray-950 dark:text-gray-50 codeblock-light border border-gray-950/10 dark:border-white/10 dark:twoslash-dark bg-transparent dark:bg-transparent" numberoflines="10" language="python">
  <div class="w-0 min-w-full max-w-full py-3.5 px-4 h-full dark:bg-codeblock relative text-sm leading-6 children:!my-0 children:!shadow-none children:!bg-transparent transition-[height] duration-300 ease-in-out [&_*]:ring-0 [&_*]:outline-none [&_*]:focus:ring-0 [&_*]:focus:outline-none [&_pre>code]:pr-[3rem] [&_pre>code>span.line-highlight]:min-w-[calc(100%+3rem)] [&_pre>code>span.line-diff]:min-w-[calc(100%+3rem)] rounded-2xl bg-white overflow-x-auto scrollbar-thin scrollbar-thumb-rounded scrollbar-thumb-black/15 hover:scrollbar-thumb-black/20 active:scrollbar-thumb-black/20 dark:scrollbar-thumb-white/20 dark:hover:scrollbar-thumb-white/25 dark:active:scrollbar-thumb-white/25" data-component-part="code-block-root" tabindex="0">
    <div class="font-mono whitespace-pre leading-6">
      <pre class="shiki shiki-themes github-light-default dark-plus" language="python">
        <code language="python">
          <span class="source python"><span class="meta function python"><span class="storage type function python">def</span> <span class="entity name function python"><span class="meta generic-name python">set</span></span>.<span class="entity name function python"><span class="meta generic-name python">remove</span></span></span><span class="meta function parameters python"><span class="punctuation section parameters begin python">(</span></span><span class="meta function parameters python">
          <span class="variable parameter python">value</span></span><span class="meta function parameters annotation python"><span class="punctuation separator annotation parameter python">:</span> <a href="/axl/types/typing">typing</a><span class="punctuation accessor dot python">.</span><a href="/axl/types/typing">Any</a></span><span class="meta function parameters python"><span class="punctuation separator parameters python">,</span>
          /
          <span class="punctuation section parameters end python">)</span></span><span class="meta function python"> </span><span class="meta function annotation return python"><span class="punctuation separator annotation return python">-></span> <a href="/axl/types">None</a></span></span>
        </code>
      </pre>
    </div>
  </div>
</div>

Remove the item from the set. It raises an error if there is no such item.

`remove` fails if the key is unhashable or if the dictionary is
frozen.
Time complexity of this operation is *O(N)* where *N* is the number of entries in the set.

```
x = set([1, 2, 3])
x.remove(2)
x == set([1, 3])
```

A subsequent call to `x.remove(2)` would yield an error because the
element won't be found.

```
x = set([1, 2, 3])
x.remove(2)
x.remove(2) # error: not found
```

`function` **set.symmetric\_difference**

<div class="code-block mt-5 mb-8 not-prose rounded-2xl relative group text-gray-950 dark:text-gray-50 codeblock-light border border-gray-950/10 dark:border-white/10 dark:twoslash-dark bg-transparent dark:bg-transparent" numberoflines="10" language="python">
  <div class="w-0 min-w-full max-w-full py-3.5 px-4 h-full dark:bg-codeblock relative text-sm leading-6 children:!my-0 children:!shadow-none children:!bg-transparent transition-[height] duration-300 ease-in-out [&_*]:ring-0 [&_*]:outline-none [&_*]:focus:ring-0 [&_*]:focus:outline-none [&_pre>code]:pr-[3rem] [&_pre>code>span.line-highlight]:min-w-[calc(100%+3rem)] [&_pre>code>span.line-diff]:min-w-[calc(100%+3rem)] rounded-2xl bg-white overflow-x-auto scrollbar-thin scrollbar-thumb-rounded scrollbar-thumb-black/15 hover:scrollbar-thumb-black/20 active:scrollbar-thumb-black/20 dark:scrollbar-thumb-white/20 dark:hover:scrollbar-thumb-white/25 dark:active:scrollbar-thumb-white/25" data-component-part="code-block-root" tabindex="0">
    <div class="font-mono whitespace-pre leading-6">
      <pre class="shiki shiki-themes github-light-default dark-plus" language="python">
        <code language="python">
          <span class="source python"><span class="meta function python"><span class="storage type function python">def</span> <span class="entity name function python"><span class="meta generic-name python">set</span></span>.<span class="entity name function python"><span class="meta generic-name python">symmetric\_difference</span></span></span><span class="meta function parameters python"><span class="punctuation section parameters begin python">(</span></span><span class="meta function parameters python">
          <span class="variable parameter python">other</span></span><span class="meta function parameters annotation python"><span class="punctuation separator annotation parameter python">:</span> <a href="/axl/types/typing">typing</a><span class="punctuation accessor dot python">.</span><a href="/axl/types/typing">Iterable</a></span><span class="meta function parameters python"><span class="punctuation separator parameters python">,</span>
          /
          <span class="punctuation section parameters end python">)</span></span><span class="meta function python"> </span><span class="meta function annotation return python"><span class="punctuation separator annotation return python">-></span> <a href="/axl/types/set">set</a><span class="meta item-access python"><span class="punctuation section brackets begin python">\[</span></span><span class="meta item-access arguments python"><a href="/axl/types/typing">typing</a><span class="punctuation accessor dot python">.</span><a href="/axl/types/typing">Any</a></span><span class="meta item-access python"><span class="punctuation section brackets end python">]</span></span></span></span>
        </code>
      </pre>
    </div>
  </div>
</div>

Returns a new set with elements in either the set or the specified iterable but not both. `# starlark::assert::is_true(r#" x = set([1, 2, 3]) y = [3, 4, 5] x.symmetric_difference(y) == set([1, 2, 4, 5]) # "#);`

`function` **set.union**

<div class="code-block mt-5 mb-8 not-prose rounded-2xl relative group text-gray-950 dark:text-gray-50 codeblock-light border border-gray-950/10 dark:border-white/10 dark:twoslash-dark bg-transparent dark:bg-transparent" numberoflines="10" language="python">
  <div class="w-0 min-w-full max-w-full py-3.5 px-4 h-full dark:bg-codeblock relative text-sm leading-6 children:!my-0 children:!shadow-none children:!bg-transparent transition-[height] duration-300 ease-in-out [&_*]:ring-0 [&_*]:outline-none [&_*]:focus:ring-0 [&_*]:focus:outline-none [&_pre>code]:pr-[3rem] [&_pre>code>span.line-highlight]:min-w-[calc(100%+3rem)] [&_pre>code>span.line-diff]:min-w-[calc(100%+3rem)] rounded-2xl bg-white overflow-x-auto scrollbar-thin scrollbar-thumb-rounded scrollbar-thumb-black/15 hover:scrollbar-thumb-black/20 active:scrollbar-thumb-black/20 dark:scrollbar-thumb-white/20 dark:hover:scrollbar-thumb-white/25 dark:active:scrollbar-thumb-white/25" data-component-part="code-block-root" tabindex="0">
    <div class="font-mono whitespace-pre leading-6">
      <pre class="shiki shiki-themes github-light-default dark-plus" language="python">
        <code language="python">
          <span class="source python"><span class="meta function python"><span class="storage type function python">def</span> <span class="entity name function python"><span class="meta generic-name python">set</span></span>.<span class="entity name function python"><span class="meta generic-name python">union</span></span></span><span class="meta function parameters python"><span class="punctuation section parameters begin python">(</span></span><span class="meta function parameters python">
          <span class="variable parameter python">other</span></span><span class="meta function parameters annotation python"><span class="punctuation separator annotation parameter python">:</span> <a href="/axl/types/typing">typing</a><span class="punctuation accessor dot python">.</span><a href="/axl/types/typing">Iterable</a></span><span class="meta function parameters python"><span class="punctuation separator parameters python">,</span>
          /
          <span class="punctuation section parameters end python">)</span></span><span class="meta function python"> </span><span class="meta function annotation return python"><span class="punctuation separator annotation return python">-></span> <a href="/axl/types/set">set</a><span class="meta item-access python"><span class="punctuation section brackets begin python">\[</span></span><span class="meta item-access arguments python"><a href="/axl/types/typing">typing</a><span class="punctuation accessor dot python">.</span><a href="/axl/types/typing">Any</a></span><span class="meta item-access python"><span class="punctuation section brackets end python">]</span></span></span></span>
        </code>
      </pre>
    </div>
  </div>
</div>

Return a new set with elements from the set and all others. Unlike Python does not support variable number of arguments. `# starlark::assert::is_true(r#" x = set([1, 2, 3]) y = [3, 4, 5] x.union(y) == set([1, 2, 3, 4, 5]) # "#);`

`function` **set.update**

<div class="code-block mt-5 mb-8 not-prose rounded-2xl relative group text-gray-950 dark:text-gray-50 codeblock-light border border-gray-950/10 dark:border-white/10 dark:twoslash-dark bg-transparent dark:bg-transparent" numberoflines="10" language="python">
  <div class="w-0 min-w-full max-w-full py-3.5 px-4 h-full dark:bg-codeblock relative text-sm leading-6 children:!my-0 children:!shadow-none children:!bg-transparent transition-[height] duration-300 ease-in-out [&_*]:ring-0 [&_*]:outline-none [&_*]:focus:ring-0 [&_*]:focus:outline-none [&_pre>code]:pr-[3rem] [&_pre>code>span.line-highlight]:min-w-[calc(100%+3rem)] [&_pre>code>span.line-diff]:min-w-[calc(100%+3rem)] rounded-2xl bg-white overflow-x-auto scrollbar-thin scrollbar-thumb-rounded scrollbar-thumb-black/15 hover:scrollbar-thumb-black/20 active:scrollbar-thumb-black/20 dark:scrollbar-thumb-white/20 dark:hover:scrollbar-thumb-white/25 dark:active:scrollbar-thumb-white/25" data-component-part="code-block-root" tabindex="0">
    <div class="font-mono whitespace-pre leading-6">
      <pre class="shiki shiki-themes github-light-default dark-plus" language="python">
        <code language="python">
          <span class="source python"><span class="meta function python"><span class="storage type function python">def</span> <span class="entity name function python"><span class="meta generic-name python">set</span></span>.<span class="entity name function python"><span class="meta generic-name python">update</span></span></span><span class="meta function parameters python"><span class="punctuation section parameters begin python">(</span></span><span class="meta function parameters python">
          <span class="variable parameter python">other</span></span><span class="meta function parameters annotation python"><span class="punctuation separator annotation parameter python">:</span> <a href="/axl/types/typing">typing</a><span class="punctuation accessor dot python">.</span><a href="/axl/types/typing">Iterable</a></span><span class="meta function parameters python"><span class="punctuation separator parameters python">,</span>
          /
          <span class="punctuation section parameters end python">)</span></span><span class="meta function python"> </span><span class="meta function annotation return python"><span class="punctuation separator annotation return python">-></span> <a href="/axl/types">None</a></span></span>
        </code>
      </pre>
    </div>
  </div>
</div>

Update the set by adding items from an iterable. `# starlark::assert::is_true(r#" x = set([1, 3, 2]) x.update([4, 3]) list(x) == [1, 3, 2, 4] # "#);`
