On Mon, Mar 14, 2022 at 11:53:37AM -0700, Christopher Barker wrote:
> I don't think it should be added to mutable types -- there are already ways
> to do that, and there are any number of "make a new one with some change"
> methods that mutables don't have.
How do we make a new list with a change other than the same slice and
concatenation we use with tuples?
alist[:i] + [value] + alist[i+1:]
I mean as an expression, of course we can split it over two statements:
newlist = alist[:]
newlist[i] = value
which is fine, but it does lose the expressiveness of an expression :-)
--
Steve
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/XY467Q2HACUJRR647BXDLBD6AFWOECZK/
Code of Conduct: http://python.org/psf/codeofconduct/