<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/python-3-15-s-best-new-features-nuzdgpef2" -->

---
title: Python 3.15's best new features | daily.dev
description: Python 3.15 ships with UTF-8 as the default file encoding on all operating systems (including Windows, which previously used legacy code pages like CP-1252), a...
canonical: https://daily.dev/posts/python-3-15-s-best-new-features-nuzdgpef2
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Python 3.15's best new features | daily.dev
og:description: Python 3.15 ships with UTF-8 as the default file encoding on all operating systems (including Windows, which previously used legacy code pages like CP-1252), a...
og:url: https://daily.dev/posts/python-3-15-s-best-new-features-nuzdgpef2
og:image: https://api.daily.dev/og/posts/nuzdgpEF2.png
og:image:alt: Python 3.15's best new features
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Python 3.15's best new features

**[Planet Python](https://daily.dev/sources/planetpython)** · 10 min read · 1 upvotes · 0 comments

## Summary

Python 3.15 ships with UTF-8 as the default file encoding on all operating systems (including Windows, which previously used legacy code pages like CP-1252), a new built-in sentinel type for creating named sentinel values, iterable/dict unpacking support inside comprehensions (e.g. [*sub for sub in nested]), explicit lazy imports via the lazy keyword for faster startup, and a new profiling package with a low-overhead sampling profiler (profiling.sampling) that can attach to already-running processes. Other additions include improved error messages suggesting correct method names, more colorized CLI output, a new frozendict type, pprint's expand=True option, and re.prefixmatch as a clearer alias for re.match.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.pythonmorsels.com/python315>

## Questions this post answers

### What is the default file encoding in Python 3.15 on Windows?

Python 3.15 makes UTF-8 the default file encoding on all operating systems, including Windows. Previously Windows used a legacy code page such as CP-1252 depending on system language settings, which could silently garble accented characters or raise a UnicodeEncodeError when writing emoji. Now a file written on one machine reads correctly on every other machine without passing encoding explicitly.

_Teams shipping cross-platform Python tools can track encoding changes like this one on daily.dev before they hit production._

### How do explicit lazy imports work in Python 3.15?

Python 3.15 adds a lazy keyword, used as 'lazy import json' or 'lazy from collections import Counter', which defers loading a module until it's first actually used rather than at import time. This is primarily meant to improve startup time in command-line programs where some modules may never execute, and provides little benefit in long-running processes like web servers.

_Developers optimizing CLI startup times can follow syntax changes like lazy imports on daily.dev._

### Can you use asterisk unpacking inside a list comprehension in Python?

As of Python 3.15, yes: syntax like [*sub for sub in nested] now flattens a list of lists directly inside a comprehension, whereas Python 3.14 and earlier raised a SyntaxError and required a double for-clause comprehension such as [x for sub in nested for x in sub]. This also works in set comprehensions, generator expressions, and dict comprehensions using double asterisk unpacking.

_Python developers adopting new syntax features can keep up with changes like comprehension unpacking on daily.dev._

## Similar posts on daily.dev

- [Python Insider: Python 3.15.0 alpha 6](https://daily.dev/posts/python-insider-python-3-15-0-alpha-6-f85iqcqtk) · Python Insider · 10 upvotes · 0 comments
- [Exciting Python features are on the way](https://daily.dev/posts/exciting-python-features-are-on-the-way-u7lhkabec) · InfoWorld · 0 upvotes · 0 comments

---

Tags: [#python](https://daily.dev/tags/python)

[View this post on daily.dev](https://daily.dev/posts/python-3-15-s-best-new-features-nuzdgpef2)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Python 3.15's best new features","url":"https://daily.dev/posts/python-3-15-s-best-new-features-nuzdgpef2","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/python-3-15-s-best-new-features-nuzdgpef2"},"datePublished":"2026-10-09T16:52:27.577Z","dateModified":"2026-10-12T09:56:58.335Z","description":"Python 3.15 ships with UTF-8 as the default file encoding on all operating systems (including Windows, which previously used legacy code pages like CP-1252), a...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/1fd94a366083de5a1b171157110815cf?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/1fd94a366083de5a1b171157110815cf?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Planet Python","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Planet Python","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/eac3cc584cb043b5a242d13752bd3d0c","url":"https://daily.dev/sources/planetpython"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/python-3-15-s-best-new-features-nuzdgpef2","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"python","timeRequired":"PT10M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Planet Python","item":"https://daily.dev/sources/planetpython"},{"@type":"ListItem","position":3,"name":"Python 3.15's best new features"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/python-3-15-s-best-new-features-nuzdgpef2#faq","mainEntity":[{"@type":"Question","name":"What is the default file encoding in Python 3.15 on Windows?","acceptedAnswer":{"@type":"Answer","text":"Python 3.15 makes UTF-8 the default file encoding on all operating systems, including Windows. Previously Windows used a legacy code page such as CP-1252 depending on system language settings, which could silently garble accented characters or raise a UnicodeEncodeError when writing emoji. Now a file written on one machine reads correctly on every other machine without passing encoding explicitly. Teams shipping cross-platform Python tools can track encoding changes like this one on daily.dev before they hit production."}},{"@type":"Question","name":"How do explicit lazy imports work in Python 3.15?","acceptedAnswer":{"@type":"Answer","text":"Python 3.15 adds a lazy keyword, used as 'lazy import json' or 'lazy from collections import Counter', which defers loading a module until it's first actually used rather than at import time. This is primarily meant to improve startup time in command-line programs where some modules may never execute, and provides little benefit in long-running processes like web servers. Developers optimizing CLI startup times can follow syntax changes like lazy imports on daily.dev."}},{"@type":"Question","name":"Can you use asterisk unpacking inside a list comprehension in Python?","acceptedAnswer":{"@type":"Answer","text":"As of Python 3.15, yes: syntax like [*sub for sub in nested] now flattens a list of lists directly inside a comprehension, whereas Python 3.14 and earlier raised a SyntaxError and required a double for-clause comprehension such as [x for sub in nested for x in sub]. This also works in set comprehensions, generator expressions, and dict comprehensions using double asterisk unpacking. Python developers adopting new syntax features can keep up with changes like comprehension unpacking on daily.dev."}}]}
```

