mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-02 19:39:49 +09:00
Functions like `functools.singledispatch` are sensitive to the order of items in the `__annotations__` map. CPython puts returns last.
11 lines
257 B
Python
11 lines
257 B
Python
from typing import get_type_hints
|
|
|
|
def func(s: str) -> int:
|
|
return int(s)
|
|
|
|
hints = get_type_hints(func)
|
|
|
|
# The order of type hints matters for certain functions
|
|
# e.g. functools.singledispatch
|
|
assert list(hints.items()) == [('s', str), ('return', int)]
|