Python 3.15: What's New for Learners, With Code
Quick answer
What changed in Python 3.15 for learners: release date, lazy imports, the sampling profiler, the deprecated profile module and what to test first, with tested code.
Python 3.15 was released on 9 October 2026, and for learners the headline changes are explicit lazy imports, a new sampling profiler in the profiling module, and the deprecation of the old profile module. This guide explains each change with code tested on Python 3.15.2, and says what a beginner should try first, as of late November 2026.
Key takeaways
- According to the Python docs, Python 3.15 was released on 9 October 2026.
- PEP 810 adds explicit lazy imports with a new "lazy" soft keyword, so a module loads only when first used.
- PEP 799 adds a profiling module with a sampling profiler; the older profile module is deprecated and will be removed in Python 3.17.
- Install 3.15 in a virtual environment, run your existing course code and read any deprecation warnings.
On this page:
- When was Python 3.15 released?
- What changed in Python 3.15?
- What is lazy import?
- What is the new profiling module?
- What else is worth a try?
- Is Python 3.15 safe for learning?
- How should you test it?
- Next step
- Frequently asked questions
| Change | PEP | What a learner can try |
|---|---|---|
| Explicit lazy imports | 810 | Write lazy import json and see when it loads |
| profiling module, sampling profiler | 799 | Profile a slow loop |
| frozendict built-in | 814 | Make an immutable dictionary |
| sentinel built-in | 661 | Read the docs before using |
| UTF-8 as default encoding | 686 | Check file reading on your system |
| math.integer module | 791 | Read the docs |
| Unpacking in comprehensions | 798 | Flatten a list of lists |
| Frame pointers enabled by default | 831 | No code change needed |
When was Python 3.15 released?
On 9 October 2026, according to the Python 3.15 What's New page. The official schedule in PEP 790 lists the final release as Friday, 2026-10-09, release candidate 3 as Friday, 2026-10-02, release candidate 2 as Tuesday, 2026-09-01 and beta 1 as Thursday, 2026-05-07.
The schedule also notes that no new features are accepted after beta 1. So the feature list you see now was fixed in May 2026, and later releases fixed bugs. The What's New page includes sections for notable changes in 3.15.2 and 3.15.3, which are bugfix releases. PEP 790 lists 3.15.1 and 3.15.2 as released in October 2026 and 3.15.3 as expected on 8 December 2026. If you read a blog post giving a different release date, trust the Python documentation.
What changed in Python 3.15?
The What's New page lists these features with PEP numbers: PEP 814 (a frozendict built-in), PEP 661 (a sentinel built-in), PEP 686 (UTF-8 as the default encoding), PEP 791 (a math.integer module), PEP 798 (unpacking in comprehensions) and PEP 831 (frame pointers enabled by default). It also lists improved error messages and an upgraded experimental JIT compiler.
You do not need to learn them all. Pick the two or three that touch your own code, and treat the rest as reading. If you are still building your Python base first, start with our 30-day Python learning plan, and keep the Python cheat sheet for beginners nearby.
What is lazy import?
A lazy import delays loading a module until you first use it. The What's New page, describing PEP 810, says that when you mark an import as lazy, Python defers the actual module loading until the imported name is first used. The new "lazy" soft keyword marks it.
Why care? Big programs import many modules at start-up, and some are used rarely. Loading them only when needed can shorten start-up. Here is a script I ran on Python 3.15.2. It will not run on older versions, because the syntax is new.
import sys
import time
lazy import json
print("json loaded right after the import line?", "json" in sys.modules)
start = time.perf_counter()
data = json.dumps({"a": 1})
elapsed = time.perf_counter() - start
print("json loaded after first use?", "json" in sys.modules)
print(data)
print(f"first use took {elapsed * 1000:.2f} ms")It printed False for the first check, True for the second and the JSON text {"a": 1}. The timing line varies by machine, so do not copy my number. In practice the json module is already cheap to load. The demo shows the behaviour: the module is not in sys.modules until the name is used. To measure start-up gains, try a heavier module and compare total run time with and without lazy.
What is the new profiling module?
It is a new module for profiling, meaning finding which parts of a program are slow. PEP 799 adds a statistical sampling profiler, named Tachyon, as profiling.sampling. According to the What's New page, it supports sampling rates of up to 1,000,000 Hz.
A sampling profiler looks at the program many times a second and records where it is, instead of tracing every call. Try it on a simple loop:
def work():
total = 0
for i in range(2_000_000):
total += i * i
return total
print(work())Save this as prof.py and run python -m profiling.sampling run prof.py. The command exists on 3.15.2, but on my Mac it stopped with a permission message asking for elevated permissions, so on macOS you may need to run it with administrator rights, as the message itself suggests. Check the module documentation for the options and output formats before relying on exact flags.
The same page says the profile module is deprecated and will be removed in Python 3.17. When I imported it on 3.15.2 it printed a DeprecationWarning suggesting profiling.tracing or cProfile. Older tutorials that use profile will still show it, so prefer cProfile or the new module in new code.
What else is worth a try?
Two small features are easy to test on 3.15.2. The first is frozendict, an immutable dictionary built in to the language by PEP 814. The second is unpacking in comprehensions, from PEP 798.
rows = [[1, 2], [3], [4, 5]]
print([*r for r in rows]) # [1, 2, 3, 4, 5]
settings = frozendict(mode="exam", retries=3)
print(settings)
try:
settings["mode"] = "live"
except TypeError as err:
print("TypeError:", err)The first print flattens the list of lists. The frozendict refuses assignment, raising a TypeError, which is useful for configuration you do not want changed by accident. The What's New page lists these features; check it for the exact rules before using them in production code. The UTF-8 default (PEP 686) matters if you read text files, so test file-reading code on your system, especially if it runs on Windows.
Is Python 3.15 safe for learning?
Yes for practice, with one habit: use a virtual environment so your main Python setup stays as it was. It is a final release dated 9 October 2026, and bugfix releases up to 3.15.2 have already shipped.
Check what your course or project requires first. Some libraries lag behind new Python versions, and a course may pin an older version. If a library fails to install on 3.15, go back to the version the course recommends. For choosing languages more broadly, see Go vs Python, and for release timing and support windows, see our Python release cycle and end-of-life dates.
How should you test it?
Use a short routine that surfaces problems early.
- Install Python 3.15 and create a virtual environment with it.
- Reinstall the packages your project needs and note any that fail.
- Run your existing code and tests, and read every deprecation warning.
- Replace any use of the deprecated
profilemodule. - Try one new feature in a scratch file, not in your main project.
For project ideas to run on the new version, see Python project ideas, and if you work with data, Python for data science and best Python libraries for data analysis. For the wider skill list, read essential Python developer skills.
Next step
Create a virtual environment with Python 3.15 today and run the lazy import script above. Then open the official What's New page and read the section for one feature you want. The page is updated by the Python team, so check it for later bugfix notes.
Frequently asked questions
When was Python 3.15 released?
According to the Python documentation, Python 3.15 was released on 9 October 2026. PEP 790 lists the final release as Friday, 2026-10-09.
What is lazy import in Python 3.15?
PEP 810 adds a lazy soft keyword. When you mark an import as lazy, Python defers loading the module until the imported name is first used. Example: lazy import json.
What is the new profiling module?
PEP 799 adds a profiling module that includes a statistical sampling profiler called Tachyon, available as profiling.sampling, with sampling rates of up to 1,000,000 Hz according to the docs.
Is Python 3.15 safe to use for learning?
Yes for practice, in a virtual environment. Check that your course and libraries support it, and fall back to the recommended version if something fails to install.
What changed in UTF-8 default encoding?
PEP 686 makes UTF-8 the default encoding in Python 3.15, according to the What's New page. If your code reads text files, test it on your system, especially on Windows.
Is the profile module removed?
Not yet. The docs say the profile module is deprecated and will be removed in Python 3.17. Use cProfile or the new profiling module in new code.