Overview
Explore the intricacies of static analysis for Python in this 51-minute conference talk from EuroPython 2013. Delve into the challenges posed by Python's dynamic nature and discover how static analysis can help prevent runtime errors. Learn about the layered code model, parsing techniques, and tools like PyFlakes. Examine the complexities of resolving names, imports, and attributes in Python code. Investigate static type systems, type inference, and the role of standard library annotations. Gain insights into overcoming various dynamic challenges and understand when static analysis tools truly excel in improving Python development.
Syllabus
Intro
Charm
Python is dynamic (3)
Downside: runtime errors
Solution: static analysis
How it works
Errors in the example
Layered code model
Parser
Standard or custom?
Resolving names
Resolving local names
PyFlakes tool
Dynamic challenge #1
Resolving imports
Dynamic challenge #4
The updated example
Resolving attributes
Primary type info sources
Static type systems for Python
Type inference in practice
Standard library annotations
Static-only type info
Dynamic challenge #7
More dynamic challenges
The results
When tools rock (2)
Wrap up
Taught by
EuroPython Conference