We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
Talks - Antonio Cuni: SPy (Static Python) lang: fast as C, Pythonic as Python
Learn about SPy (Static Python), a fast, compilable Python subset that combines C-like performance with Python's ergonomics through static typing and compile-time optimization.
- 
    SPy (Static Python) aims to be a fast, compilable subset of Python that maintains Pythonic feel while removing features that make compilation difficult 
- 
    Key differences from standard Python: - Static typing is strictly enforced
- Immutable by default after initialization phase
- Static dispatch instead of dynamic dispatch
- Three distinct execution phases: import time, freeze phase, runtime
 
- 
    Compilation approach: - Uses “redshift” process to evaluate and optimize away “blue” nodes (compile-time logic)
- Remaining “red” nodes represent runtime operations
- Can generate C code, WebAssembly, or C Python extensions
 
- 
    Performance optimizations: - Pre-computes and resolves lookups at compile time
- Eliminates dynamic dispatch overhead
- Allows direct memory access for struct-like classes
- Specializes functions based on types
 
- 
    Development goals: - Easy to implement and understand
- Opt-in approach - use .spy extension for SPy features
- Integration with existing Python ecosystem
- Support for WebAssembly target
- Focus on compile-time optimization while maintaining high-level API
 
- 
    Trade-offs: - Not 100% Python compatible
- Removes some dynamic Python features
- Requires explicit type annotations
- More restrictive semantics than Python
 
- 
    Use cases: - Performance-critical code
- WebAssembly applications
- Systems programming in Python
- Typed APIs and frameworks