[Python-ideas] Wild idea about mutability

Sven R. Kunze srkunze at mail.de
Wed Jun 15 14:07:27 EDT 2016


On 08.06.2016 16:33, Eric V. Smith wrote:
> See the rejected PEP-351 for one version of the freeze protocol.

Wow, still 11 years later equal thoughts arise again.


Reading through the rejection notes, I can see the concerns are as 
abstract as the use-cases (" good design", "net harmful effect", "Liskov 
violation", ...). I think the reservations are similar to those to other 
dynamic-increasing features like duck-typing, lambdas, closures: 
changing/defining an object right there where you need it to be 
changed/defined with the intend to convert it to a traditional (static) 
style later. I have to admit I don't like this style much but I catch 
myself doing it recently quite often. So, just for the sake of 
completeness, the concrete use-cases from my point of view:

1) debugging (like assert which theoretically is not necessary in 
production)

2) providing a correct/drop-in blue-print for immutable objects (the 
"intentional, essential part" from Raymond's post)

3) benefits of immutable objects (like faster development, 
error-reduction, etc.) <- not sure if that qualifies as a use-case


This, said. I for one would not be averse to a immutability 
mixin/freezing protocol although I don't see a point in producing 
freezed copies recursively as PEP-351 did.


Best,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160615/df41c69a/attachment.html>


More information about the Python-ideas mailing list