On Wed, Feb 27, 2019 at 02:15:53PM -0800, Barry Warsaw wrote:
I’m just relaying a data point. Some Python folks I’ve worked with do make the connection between dicts and sets, and have questions about the ordering guarantees of then (and how they relate).
Sets and dicts are not related by inheritence (except that they're both subclasses of ``object``, but so is everything else). They don't share an implementation. They don't provide the same API. They don't do the same thing, except in the most general sense that they are both collections.
What connection are these folks making?
If they're old-timers, or read some Python history, they might remember back in the ancient days when sets were implemented on top of dicts, or even before then, when we didn't have a set type at all and used dicts in an ad-hoc way.
But apart from that long-obsolete historical connection, I think the two types are unrelated and the behaviour of one has little or no implications for the behaviour of the other.
"Cars have windows that you can open. Submarines should have the same. They're both vehicles, right?"