Hacker News new | past | comments | ask | show | jobs | submit login

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.




It'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 = [], [].




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: