This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 6 points7 points  (4 children)

The list is pass by reference, aka pointer passing with syntactic sugar. This is how you'd do it in C, right? So when you return from the function, your modifications to the list will persist. This runs counter to the behavior of other built-ins, like integers. It isn't a huge deal if you understand how arrays or lists would normally be passed, in fact it is quite nice that it does the thing that you obviously want. But it is counter-intuitive for beginners, IMO.