<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/python-3-15-s-unpacking-operator-allows-flattening-lists-easily-domvxkyna" -->

---
title: Python 3.15's Unpacking Operator Allows Flattening Lists...
description: The unpacking operator inside a list comprehension can flatten a list of lists. The classic approach needs two nested for loops, written as 'x for y in my_list...
canonical: https://daily.dev/posts/python-3-15-s-unpacking-operator-allows-flattening-lists-easily-domvxkyna
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Python 3.15's Unpacking Operator Allows Flattening Lists Easily | daily.dev
og:description: The unpacking operator inside a list comprehension can flatten a list of lists. The classic approach needs two nested for loops, written as 'x for y in my_list...
og:url: https://daily.dev/posts/python-3-15-s-unpacking-operator-allows-flattening-lists-easily-domvxkyna
og:image: https://api.daily.dev/og/posts/DOmvxkyNA.png
og:image:alt: Python 3.15's Unpacking Operator Allows Flattening Lists Easily
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 Unpacking Operator Allows Flattening Lists Easily

**[NeuralNine](https://daily.dev/sources/neuralnine)** · 1 min read · 2 upvotes · 0 comments

## Summary

The unpacking operator inside a list comprehension can flatten a list of lists. The classic approach needs two nested for loops, written as 'x for y in my_list for x in y', which the speaker finds confusing because of the ordering. The new approach writes a single comprehension, 'x for x in my_lists', and then unpacks x, which the speaker says has the exact same effect.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.youtube.com/watch?v=ZOJlJmtNruU>

## Questions this post answers

### How do I flatten a list of lists in Python 3.15 using the unpacking operator in a comprehension?

Write a single list comprehension like 'x for x in my_lists' and then unpack x with the unpacking operator, which flattens the nested list without needing two for loops. This replaces the classic double for-loop form 'x for y in my_list for x in y', which requires writing 'for y' before 'for x' even though the intuitive reading order is reversed.

_Developers tracking new Python syntax changes can follow comprehension updates like this on daily.dev._

## Similar posts on daily.dev

- [How to Flatten a List of Lists in Python Quiz – Real Python](https://daily.dev/posts/how-to-flatten-a-list-of-lists-in-python-quiz-real-python-bfxfmiuno) · Real Python · 1 upvotes · 0 comments
- [All iteration is the same in Python](https://daily.dev/posts/all-iteration-is-the-same-in-python-kmgraqtz3) · Planet Python · 1 upvotes · 0 comments

---

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

[View this post on daily.dev](https://daily.dev/posts/python-3-15-s-unpacking-operator-allows-flattening-lists-easily-domvxkyna)

```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 Unpacking Operator Allows Flattening Lists Easily","url":"https://daily.dev/posts/python-3-15-s-unpacking-operator-allows-flattening-lists-easily-domvxkyna","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/python-3-15-s-unpacking-operator-allows-flattening-lists-easily-domvxkyna"},"datePublished":"2026-10-25T13:01:05.452Z","dateModified":"2026-10-25T13:01:26.829Z","description":"The unpacking operator inside a list comprehension can flatten a list of lists. The classic approach needs two nested for loops, written as 'x for y in my_list...","image":"https://i.ytimg.com/vi/ZOJlJmtNruU/sddefault.jpg","thumbnailUrl":"https://i.ytimg.com/vi/ZOJlJmtNruU/sddefault.jpg","isAccessibleForFree":true,"articleSection":"NeuralNine","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":"NeuralNine","logo":"https://media.daily.dev/image/upload/s--bMYO07OB--/f_auto,q_auto/v1777800757/logos/neuralnine?_a=BAMAMiWQ0","url":"https://daily.dev/sources/neuralnine"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/python-3-15-s-unpacking-operator-allows-flattening-lists-easily-domvxkyna","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":2},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"python","timeRequired":"PT1M","video":{"@type":"VideoObject","name":"Python 3.15's Unpacking Operator Allows Flattening Lists Easily","description":"The unpacking operator inside a list comprehension can flatten a list of lists. The classic approach needs two nested for loops, written as 'x for y in my_list...","thumbnailUrl":"https://i.ytimg.com/vi/ZOJlJmtNruU/sddefault.jpg","uploadDate":"2026-10-25T13:01:05.452Z","duration":"PT1M","url":"https://api.daily.dev/r/DOmvxkyNA","embedUrl":"https://www.youtube.com/embed/ZOJlJmtNruU"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"NeuralNine","item":"https://daily.dev/sources/neuralnine"},{"@type":"ListItem","position":3,"name":"Python 3.15's Unpacking Operator Allows Flattening Lists Easily"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/python-3-15-s-unpacking-operator-allows-flattening-lists-easily-domvxkyna#faq","mainEntity":[{"@type":"Question","name":"How do I flatten a list of lists in Python 3.15 using the unpacking operator in a comprehension?","acceptedAnswer":{"@type":"Answer","text":"Write a single list comprehension like 'x for x in my_lists' and then unpack x with the unpacking operator, which flattens the nested list without needing two for loops. This replaces the classic double for-loop form 'x for y in my_list for x in y', which requires writing 'for y' before 'for x' even though the intuitive reading order is reversed. Developers tracking new Python syntax changes can follow comprehension updates like this on daily.dev."}}]}
```

