this post was submitted on 02 Sep 2025
52 points (94.8% liked)

Python

7662 readers
4 users here now

Welcome to the Python community on the programming.dev Lemmy instance!

πŸ“… Events

PastNovember 2023

October 2023

July 2023

August 2023

September 2023

🐍 Python project:
πŸ’“ Python Community:
✨ Python Ecosystem:
🌌 Fediverse
Communities
Projects
Feeds

founded 2 years ago
MODERATORS
 

See the Solution and Explanation.

you are viewing a single comment's thread
view the rest of the comments
[–] shape_warrior_t@programming.dev 7 points 4 months ago (2 children)
[–] bterwijn@programming.dev 3 points 4 months ago

Yes, that is a surprise to many, in other languages 'x+=y' and 'x=x+y' are the same.

[–] sukhmel@programming.dev 2 points 4 months ago

To be fair, I had to read the linked question on SO to understand what was the possible alternative. I do expect that if I use += it is in place.

On the other hand with Python and Java I always keep forgetting if everything is by value or by reference, I really miss some extra clarity of the languages where you can see if something is mutable when passed to a function