3 ms·
If you reuse the variable, then you are not getting any of the alleged benefits of using variables. The same name tells little except it is perhaps the same dat
by josevalim 4y ago
If you reuse the variable, then you are not getting any of the alleged benefits of using variables. The same name tells little except it is perhaps the same data type and in Elixir you would also get this information from the module you are invoking:
text
|> String.split(“,”)
|> Enum.join(“ “)
You could also equally add comments between the lines in the dot example:
df.sort_values(“dep_date”)
# group and select
.groupby(…)[…]
Although most of the comments above are discardable (IMO) because they are restating the code.
My point is: sometimes I will break out into variables to get some of the benefits you mention. But forcing all intermediate steps to assign to variables is as harmful as using “|>” or “.” exclusively and forgetting about variables altogether. If you need to add error handling, code comments, etc, you can break out of the pipeline as needed.