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

typing.Container

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


Import

import typing
from typing import Container

Signature & Overview

typing.Container(*args, **kwargs)

Deprecated alias to collections.abc.Container.

Usage

from typing import Container

def has_admin(roles: Container[str]) -> bool:
    return "admin" in roles

assert has_admin({"admin", "editor"})

Gotchas

REPL Inspect

from typing import Container
help(Container)

Linked from

Related notes