-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Fix" Dict\pull #47
Comments
Naming is hard! "pull" is a fancy mapping transform, so can we call it that? suggestion #1 (most consistent with the current naming. Focuses on what the outputs are, and uses "with_keys" for the second case): suggestions #2 (introduce "from"):
suggestion #3 (just drop the
|
Personally I'd prefer map_keys_and_values as it's |
Strongly dislike 2 and 3 though: 2 the name doesn't really give me any expectation of what they'd do 3 seems misleading: I'd expect Dict\from_values_and_keys to take |
re: #1 Verbosity is definitely a challenge in these. "pull" is more memorable, once you get past the wtf does that do stage :-) |
ah, I now see that in your initial issue-description, you'd mentioned possibly swapping the parameter order. That would reconcile this with your preference of So, remaining concern is verbosity. Verbosity is more friendly to beginners, and experienced hack people could use autocomplete in their editor. Left to you and @kmeht ! |
HSL already has |
The primary usage of I'm actually a little tempted to remove it entirely, in favor of mapping to a tuple, then using |
IMO we should leave this alone. You pull one dict out of another. Maybe it's like turning a sweater inside out, maybe it's like pulling a rabbit out of a hat, but the current name is descriptive if not obvious. We have a huge problem in the HSL wherein many many of our method names are not obvious and there's no easy way to search them or find them -- let's not make this worse. Dict\pull is also a multipurpose amalgam method. It's very helpful and useful but it just wraps together Dict\map and Dict\map_keys in a way that gives you access to the old values for both (and the old keys for both in Dict\pull_with_key) when generating the new values for both. This makes it really hard to name with our current naming scheme which is already overly verbose / descriptive and thus easy to forget, when we have no reasonable way to actually search for what we mean. So the cost of changing from a short, snappy, easy-to-remember method name (pull) to anything longer is probably worse than doing nothing. I propose we close this as "fixed" and say that we fixed our intuitions that "pull" is a bad name. :) |
The text was updated successfully, but these errors were encountered: