3 ms·
Oh, I think I understand your question. This is a set literal, not a map literal: {"a", "b", "c"} This is a map: {"name": "Fido", "age": 8} Note the
by todd8 10y ago
Oh, I think I understand your question. This is a set literal, not a map literal:
{"a", "b", "c"}
This is a map:
{"name": "Fido", "age": 8}
Note the colons.
The point I was making is that Python doesn't make performance trade offs with these set APIs. Set union is in no way surprising. It either gives the correct intuitive result or raises an exception because of incorrect argument types.
- blain_the_train 10y agoI'm having quite the day. I think switching between clojure and python is frying my circuit. I know the difference between a map syntax and set and somehow managed to use set in place of map. I think this happened in part because my point is that any output of union(set, dict) is up to the language designer and has no basis in set theory (though i would be interested to here other wise) >>> s = set([1, 2]) >>> d = dict(x="hi") >>> s.union(d) set([1, 2, 'x']) apologies for the confusion... I need to proof read my comments more throughly.