Are instances of user-defined classes mutable?

2020-08-06 Thread ZHAOWANCHENG
the doc of dictionary said "if a tuple contains any mutable object either directly or indirectly, it cannot be used as a key." i think a instance of user-defined class is mutable, but i found it can be placed into a tuple that as a key of a dict: >>> class mycls(object): ... a = 1

Re:Re: Are instances of user-defined classes mutable?

2020-08-06 Thread ZHAOWANCHENG
At 2020-08-06 23:17:57, "Richard Damon" wrote: >On 8/6/20 10:40 AM, Robin Becker wrote: >> On 06/08/2020 05:17, ZHAOWANCHENG wrote: >>> the doc of dictionary said "if a tuple contains any mutable object >>> either directly or indirectly, it cannot be