Why Do Python Lists Multiply Oddly? A CPython Internals Deep Dive
I was scrolling down on X/Twitter when I noticed the following Python related post with 2.5k likes on it.At first glance it does appear to be a surprising output and I agree with the sentiment that it is counter intuitive. I am not going to debate whether this is the right behavior or not. Instead, I want to take this opportunity to explain the reason behind this behavior and show some CPython internal details as part of the process. We will start by a high level answer by just doing some inspec...
Read more at codeconfessions.substack.com