On Fri, Aug 7, 2020 at 11:48 PM David Mertz <mertz@gnosis.cx> wrote:
On Fri, Aug 7, 2020, 6:03 PM Paul Moore <p.f.moore@gmail.com> wrote:
> x: int[0:]  # any ints greater than or equal to zero would match, others would fail
> x: int[:101]  # any ints less than 101 match
> x: int[0:101:2]  # even less than 101

I suspect the biggest issue with this is that it's likely to be
extremely hard (given the dynamic nature of Python) to check such type assertions statically.

Yes, it's hard in the sense that it would require solving the halting problem.

That doesn't sound so hard. ;)  

Thanks for educating me. Could it at least be useful for:

1. Providing semantic meaning to code (but this is probably not enough reason on its own)
2. Couldn't it still be useful for static analysis during runtime? Not in cpython, but when the type hints are used in cython, for example?


"I've never met a Kentucky man who wasn't either thinking about going home or actually going home." - Happy Chandler