-
Notifications
You must be signed in to change notification settings - Fork 264
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
ENH: Adds a const function to functoolz #283
Conversation
The "what" of this function is pretty obvious. The "why" may not be, especially for users who don't have experience in other functional languages. I would prefer that the docstring be educational and provide a motivating use case that the typical user may want to use. I can only think of esoteric uses at the moment. If we can't cross this threshold, then I have concerns with adding such a simple function to Also, as currently implemented, the callable returned by Finally, do you think it would be worth referring to |
The most common use that I have is for working with api's that provide a callback argument. Often the callback will be passed a lot of extra information that I want to ignore because I don't need all of these features. What if |
I don't find that use case particularly compelling, because I don't see how it relates to other functionality in Our attention to serializability with pickle and performance with So, I still think the value proposition of adding this function needs to be in its documentation, which should demonstrate its usefulness. @d10genes, do you have any suggestions? |
I'm having a hard time thinking of more general examples, but for me it also seems to come up in the context of larger higher order functions that take a callback. The places where I use it are often similar to places where I may instead use I looked in the doc string for My uses of |
I also cannot think of a concrete example; however, I feel like it does fit the use case of |
One might genuinely ask whether I mostly find myself to be skeptical about Hey, maybe we should add X to toolz rather than Hey, so I use X all the time. Here are some common cases where I've found it handy, and here's why it's not easy to do with other functions / is somewhat orthogonal/composable. Now arguably a large fraction of the existing toolz API wouldn't meet this same standard (looking at you As with all things, I think that the right solution in these sorts of cases is to put it in the sandbox, see if it gets use, and then promote or cull it as that dictates. |
Another option here is for someone to go start Perhaps someone needs to start the Python equivalent of |
Very related : kachayev/fn.py#77 |
@mrocklin A Python equivalent of lodash already exists, and is pretty darn convenient: https://github.com/dgilland/pydash |
My intent was to suggest that someone follow the approach that lodash took to javascript. Make On Wed, Oct 21, 2015 at 8:17 PM, Jacob Bridges [email protected]
|
Well said, mrocklin. I would also be critical of I had an ulterior motive for seeking other So, some brainstorming ideas, although I'm not sure any of these should actually be encouraged:
>>> update_in({1: {2: 3}}, [1, 2], const(5))
{1: {2: 5}}
I would love to see a |
implements #282 based on @d10genes's suggestion