-
-
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
Better suggestion for replacement of [a] #11369
Conversation
+1
|
1 similar comment
👍 |
In the long run, perhaps |
+1 |
Doesn't this print |
@nolta; good point, I'll fix that ASAP. Filed this from an edit on github mostly because I thought it was ridiculous too open an issue for such a small a change without making it a PR 😏 Still, it seems there is support for favoring |
👍 |
1 similar comment
👍 |
Better suggestion for replacement of [a]
Was @nolta's point ever resolved? |
My bad, should be fixed. |
thanks! |
@garrison, @jakebolewski No, I never got to fixing that. Was it fixed somewhere else, or should I submit a new patch to fix it? |
👍 |
On Julia master:
With this PR:
Ever since this was introduced, I've been silently annoyed by the suggestion to use
[a;]
- the syntax feels like a hack, and for users that aren't familiar with Julia already, it's far from obvious why there's a semi-colon there, and what the difference between[a]
and[a;]
is. However, I stayed silent, since I didn't have a better suggestion.Now I do :)
I suggest we use
collect(a)
instead, for the following reasons:[a;]
eltype
, e.g.collect(Float64, 1:5)
collect(a)
over[a:]
- not sure why it didn't happen. The only argument againstcollect
was that it's slower (forUnitRange
s, specifically), but Jeff quickly retorted that with "No problem, I will make collect faster."I do realize that it doesn't generalize as nicely to higher dimensions, but since part of my problem with using
;
in the 1D case is that it feels like something that belongs with multidimensional arrays, I don't really see that as an argument against this change.