2 ms·
Yeah in Python you can do, say, a = b = [] But then the two lists are the same, and appending to one appends to the other. Not particularly useful.
by sk0g 6y ago
Yeah in Python you can do, say, a = b = []
But then the two lists are the same, and appending to one appends to the other. Not particularly useful.
- Ragib_Zaman 6y agoIt's useful when the object being assigned to those variables are literals instead of reference types, which in my experience is most of the time when you want to do the simultaneous assignment. When you do want to do reference types, you can do a,b = [], [].