Yes. To be clear, immutability isn't a use case, it's a particular
technique that can be useful for solving some problems.

This is probably a clear enough example of the XY-problem as to be worth
adding to the Wikipedia article on that topic.

We sometimes see other similar proposals to e.g. "solve" the "problem" that
Python isn't statically typed. That is, folks who want Python to be some
different language.


On Fri, Mar 11, 2022, 4:42 PM wfdc <[email protected]> wrote:

> (To be clear, I'm saying David Mertz's proposal fails the immutability
> criterion, not Christopher Barker's.)
>
> ------- Original Message -------
> On Friday, March 11th, 2022 at 4:39 PM, wfdc <[email protected]> wrote:
>
> Don't yell.
>
> You just effectively re-implemented Christopher Barker's solution (which
> was also present in the StackOverflow thread), with the downside that it
> fails the immutability criterion.
>
> Saying "just be careful not to mutate the original datastructure" isn't a
> solution. There's a reason we have immutable types: To *enforce*​
> immutability. Otherwise, why aren't you proposing getting rid of the tuple
> type entirely?
>
> ------- Original Message -------
> On Friday, March 11th, 2022 at 4:29 PM, David Mertz, Ph.D. <
> [email protected]> wrote:
>
> On Fri, Mar 11, 2022, 4:16 PM wfdc via Python-ideas <
> [email protected]> wrote:
>
>> > why haven't you used a list
>> 2. I don't want to modify the original sequence.
>>
>
> There's a really easy solution for you that will even be more perfomant.
>
> Use a list and DON'T modify the original!
>
> This is ABSOLUTELY an XY-problem.... which fact was difficult to wrestle
> out of you.
>
> >>> stuff1 = [a, b, c, d]
> >>> stuff2 = stuff1[:]
> >>> stuff2[2] = e
>
>
>
>
>
_______________________________________________
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/I5NRWYBXQSJ4SYQY7HFMWLVN4YUTRJY6/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to