Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Python 3.15 - Whats new, Whats better

Python 3.15 - Whats new, Whats better

Deck of "Python 3.15 - Whats new, Whats better" for Trivandrum Python Communiy (TriPy)

Febin Nelson P

October 28, 2026

Transcript

22 slides
  1. Agenda 01 Install with uv 02 Faster startup & safer

    text 03 New syntax & built-ins 04 Typing, errors & profiling
  2. Python 3.15 Lazy imports • UTF-8 by default • unpacking

    in comprehensions • frozendict & sentinel • TypedDict & TypeForm • better errors • profiling • deprecations
  3. Start Here: Install & Explore 1. Install Python 2. Pin

    the version 3. Run the project Install Pin with uv Check version uv python install 3.15 uv python pin 3.15 uv run --python 3.15 python -VV
  4. Faster Startup: Lazy Imports The idea The trade-off Import work

    is deferred until the name is first used. Useful for CLIs and apps that import many modules but use only a few.
  5. Safer Text: UTF-8 by Default Example with open('notes.txt', 'w') as

    f: f.write('café ') ✓ 日本語 ⽇本語 Older Python: pass encoding='utf-8' explicitly. open('notes.txt', 'w') now uses UTF-8 when encoding is omitted. This avoids localedependent surprises when writing or reading multilingual text.
  6. Sentinals A sentinel is a special value used to indicate

    something meaningful, such as “no value provided”, “end of input”, or “use the default”.
  7. Typing Improvements TypedDict describes the expected structure of a dictionary.

    closed=True explicitly says that the dictionary cannot contain keys beyond those declared in the type. These are static typing rules, not automatic runtime validation.
  8. Typing Improvements TypeForm[int] means that the argument represents a type

    expression describing int or a compatible type. TypeForm typing values that represent types
  9. Typing Improvements @disjoint_base tells the type checkers certain classes cannot

    be combined through multiple inheritance It helps catch invalid class definitions and unreachable code.
  10. Better Errors Python 3.15 improves error messages by making them

    more helpful, suggesting likely fixes instead of simply telling you what went wrong. The biggest examples are better AttributeError suggestions.
  11. Profiling We profile a program to know where a program

    spends its time and resources so you can identify what to optimize. Indicator A Indicator B 20 15 10 Python 3.15 has built-in profiling tools: 5 0 Group A Group B Group C Group D
  12. Tracing Helps identify slow functions and functions called too frequently.

    Tracks every function call, return, and exception.
  13. Before You Upgrade Check deprecated APIs: profile is deprecated; use

    profiling.tracing or profiling.sampling for profiling. Update SQLite calls: Most sqlite3.connect() parameters must now be passed as keyword arguments. Check file encodings: UTF-8 is now the default encoding, which may affect applications relying on system-specific encodings. Test dependencies: Verify that third-party libraries and C extensions support Python 3.15. Run your tests: Check warnings, serialization, database integrations, and deployment builds before upgrading. Benchmark your application: Performance improvements vary by workload; measure rather than assume.
  14. Recap 01 Typing 02 Tooling 03 Upgrade safely Lazy imports

    defer work until first use; UTF-8 default removes locale surprises. Measure startup on your own workload. New syntax and built-ins reduce boilerplate: unpacking comprehensions, immutable frozendict mappings, and unique sentinel values. Use a type checker in CI; better errors and profiling help you debug and optimize with evidence.

Other Decks in Programming