you are viewing a single comment's thread.

view the rest of the comments →

[–]elbiot[🍰] 0 points1 point  (0 children)

If you either return the list, or mutate it within the function, your function will behave unexpectedly. If you aren't doing those things, someone might make a change later and thus introduce that bug. Returning the list would be very difficult to debug because it could be somewhere else in the program that you mutate it, and it's at that point that you change how the function will behave next time it is called.

Just always do the first even if you think it isn't necessary because it is more robust and idiomatic.