Skip to content

Instantly share code, notes, and snippets.

View KotlinIsland's full-sized avatar
💭
Based

KotlinIsland

💭
Based
View GitHub Profile
from __future__ import annotations
from typing import (
_GenericAlias, Annotated, Any, Generic, Protocol, TypeVar, # type: ignore[attr-defined]
)
T = TypeVar("T")
class _ReifiedGenericAlias(_GenericAlias, _root=True):
@KotlinIsland
KotlinIsland / python_typing.md
Created October 29, 2021 10:06
python typing overview

typing

Machinery that creates type annotations and interacting with type annotations (Any / cast / get_args)

builtins

Stuff that gets injected into the global namespace(like None), also contains things that are not accessible(like NoneType)

Types

exposes some of the hidden things from builtins

collections.abc

Abstract base classes for the standard collections and functions (Sequence / Coroutine / Callable)

typeshed

type stubs for the stdlib and third party modules