<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/why-do-python-lists-multiply-oddly-exploring-the-cpython-source-code-fwitajphq" -->

---
title: Why Do Python Lists Multiply Oddly? Exploring the...
description: This post explores why Python lists multiply oddly when using the * operator. It dives into the internal implementation of lists in CPython, explaining how...
canonical: https://daily.dev/posts/why-do-python-lists-multiply-oddly-exploring-the-cpython-source-code-fwitajphq
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Why Do Python Lists Multiply Oddly? Exploring the CPython Source Code | daily.dev
og:description: This post explores why Python lists multiply oddly when using the * operator. It dives into the internal implementation of lists in CPython, explaining how...
og:url: https://daily.dev/posts/why-do-python-lists-multiply-oddly-exploring-the-cpython-source-code-fwitajphq
og:image: https://api.daily.dev/og/posts/fwITAJPhQ.png
og:image:alt: Why Do Python Lists Multiply Oddly? Exploring the CPython Source Code
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.

# Why Do Python Lists Multiply Oddly? Exploring the CPython Source Code

**[Confessions of a Code Addict](https://daily.dev/sources/codeconfessions)** · 11 min read · 2 upvotes · 1 comments

## Summary

This post explores why Python lists multiply oddly when using the * operator. It dives into the internal implementation of lists in CPython, explaining how references are stored and how the * operator works. It provides a high level answer using the REPL and then delves into the details of the list object structure in CPython. It also discusses the internal object storage mechanism and how the CPython runtime executes the * operator for lists.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://codeconfessions.substack.com/p/why-do-python-lists-multiply-oddly>

## Community discussion

Top comments from developers on daily.dev.

**@debajyatidey** · 1 upvotes

> Amazing article!

---

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

[View this post on daily.dev](https://daily.dev/posts/why-do-python-lists-multiply-oddly-exploring-the-cpython-source-code-fwitajphq)

```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":"Why Do Python Lists Multiply Oddly? Exploring the CPython Source Code","url":"https://daily.dev/posts/why-do-python-lists-multiply-oddly-exploring-the-cpython-source-code-fwitajphq","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/why-do-python-lists-multiply-oddly-exploring-the-cpython-source-code-fwitajphq"},"datePublished":"2024-03-30T07:51:49.685Z","dateModified":"2024-05-09T08:58:27.770Z","description":"This post explores why Python lists multiply oddly when using the * operator. It dives into the internal implementation of lists in CPython, explaining how...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/1395c7ff988a838bef60f866a1e3eb40?_a=AQAEufR","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/1395c7ff988a838bef60f866a1e3eb40?_a=AQAEufR","isAccessibleForFree":true,"articleSection":"Confessions of a Code Addict","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":"Confessions of a Code Addict","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/13e0f42f33864f94bf4d8f0e43234afd","url":"https://daily.dev/sources/codeconfessions"},"commentCount":1,"discussionUrl":"https://daily.dev/posts/why-do-python-lists-multiply-oddly-exploring-the-cpython-source-code-fwitajphq","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":2},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":1}],"keywords":"python,cpython","timeRequired":"PT11M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Confessions of a Code Addict","item":"https://daily.dev/sources/codeconfessions"},{"@type":"ListItem","position":3,"name":"Why Do Python Lists Multiply Oddly? Exploring the CPython Source Code"}]}
{"@context":"https://schema.org","@type":"WebPage","@id":"https://daily.dev/posts/why-do-python-lists-multiply-oddly-exploring-the-cpython-source-code-fwitajphq","comment":[{"@type":"Comment","text":"Amazing article!","datePublished":"2024-03-30T19:53:39.240Z","url":"https://daily.dev/posts/fwITAJPhQ#c-ydrWllYdi","author":{"@type":"Person","name":"Debajyati Dey","url":"https://daily.dev/debajyatidey","image":"https://avatars.githubusercontent.com/u/127122455?v=4"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1}}]}
```

