Why does append!(df1, df2) return a DataFrame, as well as modify the argument df1?

It’s a bug

Indeed, the implementation of some() errors so there certainly is a bug there. Whether it’s best solved by adding variants of append! to Base or by adding either of nothing, return, or return nothing to the implementation of some() is a different question.

It’s a bug in your implementation from misunderstanding what append! or ::Nothing actually does (or what a function actually returns when there is no explicit return, as also discussed), not in the append! function itself (or Julia for that matter). You have already had plenty of responses addressing this so I can’t imagine what more you need?

Whether it’s best solved by adding variants of append! to Base or by adding either of nothing, return, or return nothing to the implementation of some() is a different question.

I don’t see what benefit there would be to add another variant of append! that returns nothing. There is literally no penalty for it returning the collection again. If someone doesn’t want the returned value, just don’t assign it to anything and, if you really do want your function to return nothing, the user should just do that.

3 Likes