How You Can Benefit from Type Hints

How You Can Benefit from Type Hints

EuroPython Conference via YouTube Direct link

Quick Poll

3 of 22

3 of 22

Quick Poll

Class Central Classrooms beta

YouTube videos curated by Class Central.

Classroom Contents

How You Can Benefit from Type Hints

Automatically move to the next video in the Classroom when playback concludes

  1. 1 Intro
  2. 2 What This Talk is About
  3. 3 Quick Poll
  4. 4 Type Hints Used to Be Informal • An example from the standard library
  5. 5 PEP 484: Type Hints . Based on function annotations, Python 3.5 - Explicit is better than implicit
  6. 6 The Main Benefit • Improved readability for both humans and tools • Documentation - More compact and easier to grasp than lengthy native
  7. 7 The Tools
  8. 8 The Example: ElementTree
  9. 9 Exceptions
  10. 10 Add Type Hints • Start with a few function annotations
  11. 11 Type Checking
  12. 12 Let's Annotate ElementTree's API - Most type hints are simple
  13. 13 Type Inference • Tools can infer types in some cases Follow assignments to variables Return types of local functions
  14. 14 Code Completion • Context-sensitive code completion
  15. 15 Docs with Type Hints • From the docstring using the Sphinx autodoc extension
  16. 16 Type Hints for Your Public APIs
  17. 17 From Simple to Complex
  18. 18 Liberal vs Conservative
  19. 19 Type Hints in Your Code • Type hints in Python 3 function annotations It's enough to pip install a library • Compatible with Python 3.5
  20. 20 Python Stubs
  21. 21 Available Type Hints
  22. 22 Try Type Hints!

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.