From: "Guido van Rossum" <guido@python.org> > > > > How does Python decide that sequence elements are immutable? > > > > > > Huh? It doesn't. If they were mutable, had you expected something > > > else? > > > > Actually, yes. I had expcected that Python would know it didn't need > > to "put the thing back in", since the thing gets modified in > > place. Knowing that it doesn't work that way clears up a lot. > > Still, I don't understand which other outcome than [1, 6, 5] you had > expected. As I indicated in my previous mail, I didn't expect any other result. My question was about what a new type needs to do in order for things to work properly in Python. If, as I had incorrectly assumed, Python were checking a type's mutability before deciding whether it would be putting the result back into the sequence, I would need to know what criteria Python uses to decide mutability. -Dave
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4