Moving to Python 3? Let's leverage type hints in the IDE

Now that anvil is moving to Python 3, I thought I’d introduce a request to leverage type hints. One way this is done in PyCharm, for example, is if you have a function signature such as:

def f1(text: str)

and you call it like:

f1(True)

You’ll get a warning automatically highlighting the “True” and giving an error or warning.

For developers coming from more statically typed languages (C# and Java), I don’t really need to sell you on this point, but having explicit types and compile time checking is totally worth the refactoring ability + less type checking code.

There’s other obvious things you could do if the IDE had this sort of support (such as vastly improve the autocomplete), but I think this is worth mulling over.

2 Likes