On 8/07/20 10:19 PM, Peter J. Holzer wrote:
On 2020-07-08 12:26:06 +1200, dn via Python-list wrote: OTOH, using a tuple doesn't prevent the function from mutating mutable arguments:#!/usr/bin/python3 def f(*a): a[0]["new"] = 2 v = { "old": 1} f(v) print(v) prints «{'old': 1, 'new': 2}».
Very clever! Place a mutable inside the immutable parameter... Any advance on return new_mutable? -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list