Deep Dive into Python’s dict type
Let’s continue analysis from Performance Analysis of Python’s dict() and {} and dive deeper into
the Python’s internal types for dict.
I'm Kamil; I'm a software engineer and this is a collection of all things I've been working on in my personal time.
dict typeLet’s continue analysis from Performance Analysis of Python’s dict() and {} and dive deeper into
the Python’s internal types for dict.
During my 12–year journey through formal education I became very familiar with 6–point grading scale. It’s one of those things you are exposed to so early in life, that you accept it as a truth about the world. And for me, empirically, it made sense. I could always say if something was excellent, very good, good, acceptable, bad, or tragic.
Have you ever wondered how to protect your master password from getting lost? Or how to create a perfect democracy where nuke access is shared between most important people in the government equally? Or how to achieve immortality by splitting your soul and putting the pieces into objects? 🪄
If so, then you’ve come to the right place. Join me, my friend, on this discovery of Shamir’s secret sharing.
When you create a new social service on the internet, one of the things you need to think about is how to make a user’s space feel like their own. Services like GitHub, Roll20, or Reddit generate — or allow you to generate — a custom avatar (i.e. Identicons) for your account. Avatar auto-generation is especially neat, as it does not require any engagement from the user. Let’s try to figure that out on our own.
dict() and {}Some time ago, during a code review, I had a discussion with a colleague of mine about preferring dict() over {} in
new Python code. They argued that dict() is more readable — and expresses intent more clearly — therefore should
be preferred. I wasn’t convinced by that, but at that time I didn’t have any counterarguments, so I passed.
Yet that made me wonder: what’s the difference between the dict type and {} literal expression?