4 ms·
Python is at least as typed as Lua.
by empthought 9mo ago
Python is at least as typed as Lua.
- tekacs 9mo agoIt's talking about Luau (gradually typed, https://luau.org/ https://luau.org/), not Lua. Hopefully https://github.com/astral-sh/ty https://github.com/astral-sh/ty will make the Python typing situation better, but absent that, Python typing is... not great. Honestly even with that it feels subjectively very finicky.
- westurner 9mo agoicontract or pycontracts -like DbC Design-by-Contract type and constraint checking at runtime with or as fast as astral-sh/ty would make type annotations useful at runtime "Support runtime checking" : https://github.com/astral-sh/ty/issues/867 https://github.com/astral-sh/ty/issues/867 : > [ typeguard, beartype, trycast; mypyc ] mypyc/mypyc: Compile type annotated Python to fast C extensions https://github.com/mypyc/mypyc https://github.com/mypyc/mypyc src: https://github.com/python/mypy/tree/master/mypyc https://github.com/python/mypy/tree/master/mypyc .. docs: https://mypyc.readthedocs.io/en/latest/ https://mypyc.readthedocs.io/en/latest/ : mypyc docs > Using type annotations > Strict runtime type checking: https://mypyc.readthedocs.io/en/latest/using_type_annotations.html#strict-runtime-type-checking https://mypyc.readthedocs.io/en/latest/using_type_annotation... : > Mypyc ensures type safety both statically and at runtime. [...] `Any` types and erased types in general can compromise type safety, and this is by design. Inserting strict runtime type checks for all possible values would be too expensive and against the goal of high performance.
- westurner 9mo agoOh my! beartype docs: https://beartype.readthedocs.io/en/latest/ https://beartype.readthedocs.io/en/latest/ : > Welcome to the Bearpedia trycast: https://github.com/davidfstr/trycast https://github.com/davidfstr/trycast : from typing import TypedDict, Literal