Instead of adding a variable to a set correctly, e.g.:
set_to_add_to = set()
set_to_add_to.add("test")
I just accidentally coded:
set_to_add_to = set()
set_to_add_to = set_to_add_to.add("test")
While I appreciate that this is not how you should add items to a set, it surprised me that the above resulted in set_to_add_to taking the value None. I couldn't work out why that would happen: it seems analogous to int_variable = int_variable + 5, which works correctly.
Similarly:
set_to_add_to = set()
new_set = set_to_add_to.add("test")
results in new_set taking the value None — why is it not the case that "test" is added to set_to_add_to and then that assigned to new_set?