-
-
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
Feature request: Collect to Vector
#47777
Comments
This is what |
Related: #36537 |
What about |
That's not how convert is meant to be used. Maybe the vector constructor. |
Can you elaborate on that? The official documentation gives no hints on why this usage of convert might be wrong? |
@bvdmitri See the docs on conversion vs construction. Convert is only meant to be called when converting between the "same kind of things", e.g. an Futhermore, since |
As far as I can tell, there is currently no idiomatic way of collecting an arbitrary iterable into a
Vector{T}
. To me this seems like a basic operation. At least, I need it quite often.collect
does not always return aVector
collect
on aGenerator
, which preserves shape information in some cases. Hence, it does not always returnVector
vec(collect(itr))
returns an array with shared memory. I believe this can be problematic sometimes, but I'm not completely sure.[i for i in itr if true]
does work, but is not exactly idiomatic. Also, I don't think it's documented to return aVector
.The text was updated successfully, but these errors were encountered: