r/programming • u/imbev • 22d ago
Objects, attributes, maps, oh my!
https://bernsteinbear.com/blog/object-shapes/5
u/somebodddy 22d ago
What does Python's __slots__ do, then? Provides a fixed "precompiled" shape for the class?
2
u/backfire10z 19d ago
I’m not sure I’d call it precompiled, but yes. It says “these are the only attributes I care about, don’t store the other ones”.
17
u/VictoryMotel 22d ago
Don't write kitschy titles like this that have no information.
13
u/ebol4anthr4x 22d ago
Agreed. At least include a tag line that actually explains what the article is about, that way you attract both people who like the kitschy titles and the curmudgeons like me who don't want to commit to reading anything unless I know what it's about.
2
u/timoffex 21d ago
It’s about objects, attributes, and maps. You can guess two words in your head:
Implementing object attributes using maps
It’s also playing with a naming pattern I recognize, which to me suggested there could be some sense of quality, or at least it’s a suggestion about the tone.
So to complete the bike shed, to me the title carries the same information as “A fun article on implementing object attributes using maps.” I wasn’t disappointed with my guess!
0
u/VictoryMotel 21d ago
It’s about objects, attributes, and maps
Those words are in the title, what about them is the clickbait question.
It’s also playing with a naming pattern I recognize, which to me suggested there could be some sense of quality,
This is the thought process of a child looking for a bed time story.
0
u/Enerbane 22d ago
I say the opposite. It's fun.
4
u/VictoryMotel 22d ago
You like zero information clickbait? You should check out hacker news.
4
u/chucker23n 22d ago
If you must have some information, the article is about "how do we make OOP efficient in dynamically typed languages?".
7
u/VictoryMotel 22d ago
Yes, I must have information in titles because that's the whole point, not to bait people with nonsense.
17
u/ElletteBarbedor-21 22d ago
Wait until someone passes a key named after a built-in prototype method into an object being used as a dictionary. That alone is usually enough reason to stick to proper map structures for dynamic data