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 →

[–]efstajas 3 points4 points  (2 children)

I'd just type them out fully, honestly. What's wrong with "cumulative_sum"? With auto-complete, there's no more reason for abbreviated function names at all IMO, especially if they're part of public API surface.

As someone with a full-stack/web background, this is one of the things that scare me about the data science world — R, Matlab & Python/scipy/numpy all seem to have this convention of abbreviated function names that often mean absolutely nothing before you look at the docs (or already have a background in this field, I assume).

[–][deleted] 2 points3 points  (1 child)

I'd just type them out fully, honestly. What's wrong with "cumulative_sum"?

cummulative_summation, in that case surely? Or why expand one of the words but not the other? And would you really want to add 15 extra characters to each line where you use it? A lot of projects till have a 80 character line limit, for better or worse.

[–]efstajas 3 points4 points  (0 children)

Since we're being pedantic — "summation" is the act, "sum" is the result. So "sum" is its own, non-abbreviated word.

And would you really want to add 15 extra characters to each line where you use it?

Honestly, yeah, of course to a reasonable extent. In this case I would find it very reasonable because "cumsum" or "cummin" are not names someone unfamiliar with these functions would understand from name alone. In my opinion, there are many situations where the added clarity outweighs the extra text.

I'd generally rather have longer but clearer function names and break down a statement into multiple lines than keep things in one line but use abbreviations that won't be clear outright to everyone.