-
-
Notifications
You must be signed in to change notification settings - Fork 222
Expand file tree
/
Copy pathmisc_py312.py
More file actions
executable file
·37 lines (26 loc) · 822 Bytes
/
misc_py312.py
File metadata and controls
executable file
·37 lines (26 loc) · 822 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# mypy: ignore-errors
# https://github.com/python/mypy/issues/16607
"""
Testing features that either are 3.12+ only or render slightly different on 3.12.
"""
from __future__ import annotations
import typing
from typing import NamedTuple
# Testing the new Python 3.12 `type` statement.
type MyType = int
"""A custom Python 3.12 type."""
foo: MyType
"""A custom type instance."""
type MyTypeWithoutDocstring = int
MyTypeClassic: typing.TypeAlias = int
"""A "classic" typing.TypeAlias."""
# Testing a typing.NamedTuple
# we do not care very much about collections.namedtuple,
# the typing version is superior for documentation and a drop-in replacement.
class NamedTupleExample(NamedTuple):
"""
An example for a typing.NamedTuple.
"""
name: str
"""Name of our example tuple."""
id: int = 3