3 ms·
I don't think this will refute the article, but I would have found it more convincing if the benchmark had included a single setitem assignment as well, to be s
by sweezyjeezy 3y ago
I don't think this will refute the article, but I would have found it more convincing if the benchmark had included a single setitem assignment as well, to be sure that the difference wasn't python doing a lazy dict-or-set type assignment on {}
- extasia 3y agoI've also had this thought, but found that inspecting the type shows its by default a dictionary, and that it only is interpreted as a set if you treat it as such (eg add comma-seperated elements when instantiating) assert type({}) == type(dict())) assert type({1,2,3} == type(set())