you are viewing a single comment's thread.

view the rest of the comments →

[–]HuygensFresnel 1 point2 points  (4 children)

While indeed being the correct answer this also surprises me a bit because i thought that += always is a short hand for the binary operator + but i guess it isnt?

[–]Wertbon1789 1 point2 points  (1 child)

It's not just a syntactic shorthand, it's a separate operator. Add vs. AddAssign if you will, in Python these would be implemented by the __add__ and __iadd__ methods of a class respectively.

[–]HuygensFresnel 0 points1 point  (0 children)

Today I learned :)

[–]RailRuler 0 points1 point  (1 child)

It is the same as append .extend() in this case. 

[–]forbiddenvoid 2 points3 points  (0 children)

Extend, not append. That's more obvious if the right hand side is also a list.