I'd like to get the assert_type proposal finished up. I think there's broad agreement that the idea is useful, but there are concerns that the assert_type() could be confusing, because people may assume it does a runtime assertion.
I see the problem, but I don't see any better alternatives at the moment. Here are the alternatives that have been proposed in this thread:
- static_assert_type: Wordy, and confusing with C++ static_assert which does something different.
- prove_type: Probably the best option, but "prove" isn't a word we've previously used with the Python type system. It sounds to me like we're branching into automated theorem proving.
- assume, assume_type: This sounds to me like a directive to the type checker to narrow a type.
- check_type, type_check: This suggests a runtime typecheck even more strongly than assert_type() does.
What do others think? I'm happy to change the name if there's consensus for some other name.