Skip to content

Give example for caller#152

Open
antoine-gallix wants to merge 2 commits intoSuor:masterfrom
antoine-gallix:doc-caller
Open

Give example for caller#152
antoine-gallix wants to merge 2 commits intoSuor:masterfrom
antoine-gallix:doc-caller

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