4 ms·
I have always found dicts and sets being pretty much basically the same thing, with dicts allowing for "attaching" additional values to the set items. In fact,
by BerislavLopac 7y ago
I have always found dicts and sets being pretty much basically the same thing, with dicts allowing for "attaching" additional values to the set items. In fact, before sets were introduced (in Python 2.3), using dicts (with elements for keys and some arbitrary values -- commonly None -- for values) was a common way to emulate them.