Skip to content
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

Give example for caller #152

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

antoine-gallix
Copy link

The function doc, while being exact, can be hard to read. Giving an example clarifies the function's behavior.

The function doc, while being exact, can be hard to read. Giving an example clarifies the function's behavior.
@Suor
Copy link
Owner

Suor commented Apr 3, 2024

I agree that examples help. This one, however, is not very practical or illustrative. It's hard to come up with a good example for this function, especially one not covered by list comprehensions.

@antoine-gallix
Copy link
Author

I could not come up with any practical example for this function. This example at least allows to understand what the function does; better than no example at all.

@antoine-gallix
Copy link
Author

Believe it or not, I just found a use case for it at work:

metric_functions=[metric_A,metric_B,metric_C]
metrics = funcy.join(funcy.map(funcy.caller(data), metric_functions))

Would you be fine with this one?

@Suor
Copy link
Owner

Suor commented Apr 10, 2024 via email

@antoine-gallix
Copy link
Author

Allright I'll update my PR. I also just thought that the problem above would be resolved as well with:

metrics = funcy.join(funcy.juxt(metric_functions)(data))

But I guess it's not the point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants