On this page
  1. typing.AbstractSet
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

typing.AbstractSet

Up: typing | Next: typing.Annotated
Rel: typing.Annotated, typing.Any, typing.assert_never, typing.assert_type
Ref: docs.python.org — typing.AbstractSet
Tags: #public #python3 #stdlib #typing


Import

import typing
from typing import AbstractSet

Signature & Overview

typing.AbstractSet(*args, **kwargs)

Deprecated alias to collections.abc.Set.

Usage

from typing import AbstractSet

def count_unique(items: AbstractSet[str]) -> int:
    return len(items)

assert count_unique({"a", "b"}) == 2 and count_unique(frozenset(["x"])) == 1

Gotchas

REPL Inspect

from typing import AbstractSet
help(AbstractSet)

Linked from

Related notes