Can Python implement dependent types?

后端 未结 2 1240
一整个雨季
一整个雨季 2021-02-12 16:21

A simple demo of dependent types in Idris is Vector, whose type depends on its value.

We can use type hints in Python:

from typing import List

         


        
2条回答
  •  遥遥无期
    2021-02-12 16:43

    I made a library which allows you to treat types as first-class, without hard-coding in advance like David said. Of course, it's hacky too, rewriting functions to make use of type hints.

    https://github.com/vixrant/python-type-theory

提交回复
热议问题