
June 27, 2020
1:18 p.m.
On Sat, Jun 27, 2020 at 10:06 PM Rob Cliffe <rob.cliffe@btinternet.com> wrote:
Sets behave like dict keys, not their values. Obviously the last *value* will win (because that's how assignment works), but with the keys, the one already in the dictionary will be retained. Switching your example around:
When sets were introduced, I believe this behaviour of dicts was deliberately mimicked for sets, although those who've been Pythonning for longer than I have would be better able to say. ChrisA
1726
Age (days ago)
1726
Last active (days ago)
0 comments
1 participants
participants (1)
-
Chris Angelico