[Python-Dev] What if replacing items in a dictionary returns the new dictionary?
Roy Hyunjin Han
starsareblueandfaraway at gmail.com
Fri Apr 29 16:59:26 CEST 2011
2011/4/29 R. David Murray <rdmurray at bitdance.com>:
> 2011/4/29 Roy Hyunjin Han <starsareblueandfaraway at gmail.com>:
>> It would be convenient if replacing items in a dictionary returns the
>> new dictionary, in a manner analogous to str.replace()
>
> This belongs on python-ideas, but the short answer is no. The
> general language design principle (as I understand it) is that
> mutable object do not return themselves upon mutation, while
> immutable objects do return the new object.
Thanks for the responses. Sorry for the mispost, I'll post things
like this on python-ideas from now on.
RHH
More information about the Python-Dev
mailing list