Liste des Groupes | Revenir à ol advocacy |
rbowman wrote this copyrighted missive and expects royalties:$ for i in range(10): print("int %d, id = %d" % (i, id(i)))
On 14 Apr 2024 20:20:49 GMT, Stéphane CARPENTIER wrote:https://www.linkedin.com/pulse/understanding-pythons-mutable-immutable-objects-memory-gihozo
>What's that? You mean "Object Oriented"? If yes, are you really a>
programmer (in fact, I know the answer, it's a rhetorical question)? If
no, do you know that python doesn't require Object Oriented programming
(it's another rhethorical question)?
Yes and no... Everything in Python is an object but you don't necessarily
need to construct your own classes.
Integers are immutable objects in Python. When you modify an integer, a
new object is created instead of modifying the existing one.
x = 10
Wowza!
Les messages affichés proviennent d'usenet.