1. 12
  1.  

  2. 5

    🤦

    Mypy’s subtyping algorithm is most likely implemented using recursion. As evidence, when running Mypy on the infinite subtyping query described in List- ing 1, it does not run indefinitely but instead raises a segmentation fault. This observation makes it possible to measure the run time of the subtyping machine, i.e., the number of subtyping deductions it performs, by the minimal size of the call stack required by Mypy to type-check the machine.

    1. 2

      Python type hints accept any valid python expression, and stores the result as the annotation. You can print as a annotation…

      1. 2

        I had some fun with this in the past, making the type of something depend on the time of day or value of a GET request