Apr-27-2024, 07:22 PM
(Apr-27-2024, 04:57 PM)Pedroski55 Wrote: Is there a good reason why we should not pass the dictionary we want modified by name?
It's not expected that a function mutates objects from the arguments. But sporadically, it's even done in the standard library. One example is
heapq.heapify
, which mutates the list.The example with the dataclass is better because it has isolation. The item dict is attached as an attribute to the dataclass-instance.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
All humans together. We don't need politicians!