[Python-ideas] Wild idea about mutability
Sven R. Kunze
srkunze at mail.de
Mon Jun 6 03:05:40 EDT 2016
More information about the Python-ideas mailing list
Mon Jun 6 03:05:40 EDT 2016
- Previous message (by thread): [Python-ideas] Wild idea about mutability
- Next message (by thread): [Python-ideas] Wild idea about mutability
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 02.06.2016 16:18, Joao S. O. Bueno wrote: > Just remembering that one is free to implement whatever "switchable" > containers one wants in the language as it is now - no need to force > (full or slightly) incompatible changes that imply on performance > degradation onto every single Python user for a feature that was not > needed up to this day. > > Implementing this in sequence-abc, and mapping-abc classes is trivial. > > A reasonable request for the language could be exactly to allow a > "__mutable__" property on the sequence, container and mapping > protocols, and a "mutable" built-in callable, that in the absence of > "__mutable__" could check for the methods signature (if it does not > have "__mutable__" but has "__setitem__" , then mutable(obj) returns > True, for example). Is __setitem__ the only way to change an object? > On 2 June 2016 at 10:55, Sven R. Kunze <srkunze at mail.de> wrote: >> On 02.06.2016 15:05, Rob Cliffe wrote: >>> Sure, there are many difficulties. >>> This was intended to be a blue-sky idea. I would like to pose the >>> question "If I had to redesign Python from scratch, would I think this is a >>> good idea?" >> >> I don't think that's an overly stupid idea. In such regard, Python wouldn't >> be the first project dealing with mutability in this manner. PostgreSQL >> already does. >> >> One question I would have: would it be enforced? Or can objects designer >> choose between enforced immutability and informative immutability? Or would >> it be enforced inconsistently at some places where at other places it does >> not matter. >> To me the 100% enforced variant would be the least troublesome. >> >> One definite advantage of broader use of immutable objects would be >> optimization: using the same memory parts, re-using the same object etc. >> It's not my field in computer science but other people will be able to >> imagine a lot of other possibilities here. >> >> Best, >> Sven >> >> _______________________________________________ >> Python-ideas mailing list >> Python-ideas at python.org >> https://mail.python.org/mailman/listinfo/python-ideas >> Code of Conduct: http://python.org/psf/codeofconduct/
- Previous message (by thread): [Python-ideas] Wild idea about mutability
- Next message (by thread): [Python-ideas] Wild idea about mutability
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-ideas mailing list