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

Fix broken show method for Base.LogicalIndex #34551

Merged
merged 2 commits into from
Mar 27, 2020

Conversation

karan0299
Copy link
Contributor

Fixes #34364
julia> show(stdout, "text/plain", Base.LogicalIndex([true])) now shows the following output
1-element Base.LogicalIndex{Int64,Array{Bool,1}}: 1
Output is similar to that of collect method on LogicalIndex as suggested by @stevengj
In my opinion this is the appropriate change required.
Defined print_array(io,X::LogicalIndex) = print_array(io,collect(X))

@stevengj
Copy link
Member

Should we change the 2-arg show as well?

@karan0299 karan0299 force-pushed the broken_show_LogicalIndex branch from 2965c5b to dc8d5f8 Compare January 28, 2020 17:43
@karan0299
Copy link
Contributor Author

I think we should change show function with 2 args to maintain the consistency with the 3 args show method.
In my opinion output of show function with similar args i.e.
julia> show(stdout,Base.LogicalIndex([true,false,true])) should be displayed as
[1,3]
What is your opinion @stevengj ?

@karan0299
Copy link
Contributor Author

I have updated the 2 args show method as well in last commit.

@karan0299 karan0299 requested a review from stevengj January 29, 2020 16:59
@stevengj
Copy link
Member

As discussed in #34364, it seems like we may not want LogicalIndex to be a subtype of AbstractArray at all, in which case this implementation will have to change slightly.

@karan0299
Copy link
Contributor Author

karan0299 commented Mar 24, 2020

@stevengj as explained by Matt Bauman why he considers it to be a subtype of Abstract array in his comment "#34364 (comment)", is this fix fine?

@mbauman
Copy link
Member

mbauman commented Mar 27, 2020

Failures are unrelated (a timeout and a distributed test failure).

@mbauman mbauman merged commit 712731e into JuliaLang:master Mar 27, 2020
oxinabox pushed a commit to oxinabox/julia that referenced this pull request Apr 8, 2020
* Fix broken show method for Base.LogicalIndex

* Change show method with 2 args to be consistent with 3 args show method for LogicalIndex\
ravibitsgoa pushed a commit to ravibitsgoa/julia that referenced this pull request Apr 9, 2020
* Fix broken show method for Base.LogicalIndex

* Change show method with 2 args to be consistent with 3 args show method for LogicalIndex\
KristofferC pushed a commit that referenced this pull request Apr 11, 2020
* Fix broken show method for Base.LogicalIndex

* Change show method with 2 args to be consistent with 3 args show method for LogicalIndex\
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.

broken show method for Base.LogicalIndex
3 participants