Get the latest tech news
Why Do Python Lists Multiply Oddly? Exploring the CPython Source Code
A look at the internals of list implementation in CPython to understand this weird quirk about them
With this basic understanding of how the list type is defined in CPython, let’s take a look at the function where it implements handling for the* operator. The VM doesn’t need to know how the different types implement different operators, it lets the abstract object interface deal with that part. So this was all we needed to know about the CPython implementation details behind the handling of* operation on sequence type objects and to understand the reason behind that peculiar behavior for which we started this whole exploration.
Or read this on Hacker News