Hacker News new | ask | show | jobs
by Izkata 38 days ago
The square bracket version tells the reader it's required, the .get version tells the reader it's optional. Kind of the reason both exist in the language (the .get version has an optional second argument to return instead of None when the key is missing).
2 comments

That's when it's accessed, if you just have the data structure you can't tell.
The point is that the implementer shouldn’t have to investigate to know whether the key’s value is nullable.