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 -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/XY467Q2HACUJRR647BXDLBD6AFWOECZK/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to