-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Clarify the difference between collect and bracket notation for generators #50619
Conversation
CI testing reports an error in
|
That's an unrelated issue identified in #50550 |
OK thanks for the reference. Anyway in between there are not more CI errors. I guess it got fixed in the mean time. |
Hello, Before(as visible at https://docs.julialang.org/en/v1/base/collections/#Base.collect-Tuple{Any})
Return an Used by comprehensions to turn a generator into an Examples
After:(first paragraph unchanged)
Return an Used by comprehensions to turn a generator into an Examples
|
Any update @jishnub or @brenhinkeller ? |
I think the warning text should go elsewhere in the documentation, and not in the docstring of |
Thanks @jishnub for the feedback. Here is an updated docstring: Return an Used by [comprehensions](@ref man-comprehensions) to turn a [generator expression](@ref man-generators) ExamplesCollect items from a
Collect items from a generator (same output as
Summary of the changescompared to my first proposition (Sept 2023):
Also notice that I've interleaved the examples with a short explanatory text (instead of comments in the REPL code). I find it more readable, but this seems uncommon (compared to other docstrings). Is it nevertheless acceptable? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a nice improvement to me. Perhaps it could be "even better" but that shouldn't stop us from taking this already?
Or are there specific concerns with the changes I missed / am not aware of?
Other than minor comments, this looks good to me |
Co-authored-by: Jishnu Bhattacharya <jishnub.github@gmail.com>
@jishnub applied your suggestions and one other trivial fix |
Thanks for your reviews and improvements and thanks for merging! |
As a follow-up to my question on the forum Unclear documentation of
collect
? (similarity and difference with brackets), here is a tentative expansion of the docstring ofBase.collect
to clarify both the similarities and differences with the bracket notation for generators.I'm pretty sure it needs so edits, but here are the motivating factors behind the changes, by decreasing order of importance:
Feedback on my formulation is welcome!