On Wed, Nov 22, 2017 at 12:51 PM, Steven D'Aprano <st...@pearwood.info> wrote: > On Wed, Nov 22, 2017 at 11:47:28AM +1100, Chris Angelico wrote: >> On Wed, Nov 22, 2017 at 11:27 AM, Steven D'Aprano <st...@pearwood.info> >> wrote: > >> > Types are literally irrelevant to this, except in the sense that in many >> > languages, including Python, the distinction between mutable and >> > immutable is usually controlled by the type of object. But that's not >> > fundamental to the concept: we could, if we wanted, decouple the two. >> >> There's a good reason for that - the type of an object determines what >> operations make sense (you can add two numbers together, but you can't >> add two open sockets), and mutability impacts the validity of >> operations. Can you give an example of where it would make sense to >> decouple mutability from object type? > > I didn't say we should, or that I would, only that we could if we wanted > to. But for the sake of the hypothetical argument, being able to freeze > an object may be useful, as opposed to copying it into a new, frozen > object.
Ah okay. Yeah, it's certainly plausible in theory, but I've never actually wanted it. ChrisA _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/