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.

11m read time From codeconfessions.substack.com
Post cover image
Table of contents
The Short AnswerUnderstanding List Object Structure in CPythonInternal Object Storage Mechanism in CPython's ListImplementation of the Asterisk (*) Operator in List TypesHow CPython's Virtual Machine Executes the Asterisk (*) Operator for ListsSummary
1 Comment

Sort: