3 ms·
Teacher here. All my students eventually try {} + {}. I'll bet on it to be the most intuitive.
by sametmax 8y ago
Teacher here.
All my students eventually try {} + {}.
I'll bet on it to be the most intuitive.
- mar77i 8y agoStudents are supposed to set things on fire and find various nifty features for learning's sake. But with experience - and the discovery that various such features largely overlap (eg. + and .extend()), one tends to grow out of that stance and become wiser.
- rplnt 8y agoIt's intuitive to try, but it's not obvious what it actually does when keys overlap.
- mixmastamyk 8y agoIt’s obvious what you want done, and thankfully that is what’s going to be done.
- rurban 8y agothe problem with overloading add is that add results in more than merge. merge is add minus the duplicate keys. students shouldn't learn wrong semantics. {1:,2:} + {1:,3:} = {1:,2:,3:}