Contribute Media
A thank you to everyone who makes this possible: Read More

How to Use Python Type Hints Properly

Description

I think many people are already familiar with the simple Python type hints. However, there may be times when you cannot give type hints as you want in practice with only the basic usage. I felt that type hints were more useful after I learned about the various functions of Python type hints and started using them. In fact, simple type hints are often enough for most Python codes. The complex type hints introduced in this session are not used often. So I think there are often cases where you forget or do not use them because you do not know about them. In this session, rather than going into depth about the application concepts of type hints one by one, I will introduce them in general. I hope that you will vaguely remember them when you encounter a situation where you need them later. Personally, I learned a lot about this “type system for people who are not compilers” while using TypeScript. There are still many things that Python type hints are inconvenient or cannot express, but I think Python type hints have their own charm. I think the advantages are that they can be used dynamically and that they are used within existing grammar. Of course, there are limitations due to this, but I expect that they will improve as they develop further in the future. I hope that this session will be an opportunity to discuss Python type hints with more people and to spark new interest in type hints.

Details

Improve this page