Some are confused about the terms “mutable” and “immutable” in #Python or #programming in general.
A Toot could be a good example but it seems that this is not the same for everyone (in the process of changing?)
For me, at the moment, a Toot is “immutable” –> Once it’s published, it cannot be changed. I can delete it and replace it with a new one, but I cannot change the actual Toot
But for others (and from what I gather, for all of us in the near future?), a Toot is “mutable” if they can change the same toot, not just replace it with a new one
Let’s say you have a string, an immutable type in Python:
name = "Stephen"
You change your mind and want it to be upper case:
name = name.upper()
You’re creating a copy of the string which is uppercase and replacing the old string (which is binned) with the new one
That’s not the case for a list, for example, which is mutable:
numbers = [2, 5, 9]
numbers.append(100)
You change the same list, not create a new one
Will Toots change from being an immutable type to a mutable type for all of us soon?
I saw this post on Twitter, too :)
Good example, but at least on this server (mastodon.social) toots have an edit button...
@mborus Here’s they’re not. Not yet, anyway. Can’t wait…