Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
| it:programmiersprache:python:typehints [23.08.2025 08:36] – ↷ Seite von it:python:typehints nach it:programmiersprache:python:typehints verschoben marsch | it:programmiersprache:python:typehints [25.09.2026 20:08] (aktuell) – marsch | ||
|---|---|---|---|
| Zeile 3: | Zeile 3: | ||
| > <wrap em hi>ab Python 3.10</ | > <wrap em hi>ab Python 3.10</ | ||
| + | |||
| + | |||
| + | ===== Standard Typen ===== | ||
| + | |||
| + | int | ||
| + | str | ||
| + | ... | ||
| + | |||
| + | |||
| + | ===== Benutzerdefinierte Typen ===== | ||
| + | |||
| + | Check | ||
| + | <code python> | ||
| + | from typing import NewType | ||
| + | |||
| + | RGB = NewType(" | ||
| + | </ | ||
| + | |||
| + | Check | ||
| + | <code python> | ||
| + | from typing import TypeVar | ||
| + | |||
| + | TypeVar ..... # < 3.12 | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== Generische Typen ===== | ||
| + | |||
| + | <code python> | ||
| + | def funktion[T](items: | ||
| + | </ | ||
| + | |||
| + | |||
| + | ====== Notizen ====== | ||
| + | |||
| + | > ab Python 3.5 ([[https:// | ||
| + | |||
| + | Any, Union, Tuple, Callable TypeVar, Generic\\ Dict, List | ||
| + | |||
| + | <neuer Typ> = NewType('< | ||
| + | |||