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

show(::OffsetArrays.IdOffsetRange should show its type #121

Closed
goretkin opened this issue Jun 12, 2020 · 5 comments · Fixed by #143
Closed

show(::OffsetArrays.IdOffsetRange should show its type #121

goretkin opened this issue Jun 12, 2020 · 5 comments · Fixed by #143

Comments

@goretkin
Copy link
Contributor

import OffsetArrays

julia> Base.OneTo(3)
Base.OneTo(3)

julia> Base.IdentityUnitRange(1:3)
Base.IdentityUnitRange(1:3)

julia> OffsetArrays.IdOffsetRange(1:3)
1:3

I think this might be misleading, as I mentioned in #120 (comment)

@jishnub
Copy link
Member

jishnub commented Sep 9, 2020

I second this, mind submitting a PR?

@johnnychen94
Copy link
Member

johnnychen94 commented Sep 10, 2020

It is a good argument. However, I'm not very positive to this:

Before:

julia> Ao = zeros(-3:3, -3:3)
7×7 OffsetArray(::Array{Float64,2}, -3:3, -3:3) with eltype Float64 with indices -3:3×-3:3:
...

julia> axes(Ao)
(-3:3, -3:3)

After: (pretty hard to get the necessary axes information)

julia> Ao = zeros(-3:3, -3:3)
7×7 OffsetArray(::Array{Float64,2}, OffsetArrays.IdOffsetRange(-3:3), OffsetArrays.IdOffsetRange(-3:3)) with eltype Float64 with indices OffsetArrays.IdOffsetRange(-3:3)×OffsetArrays.IdOffsetRange(-3:3):
...

julia> axes(Ao)
(OffsetArrays.IdOffsetRange(-3:3), OffsetArrays.IdOffsetRange(-3:3))

@jishnub
Copy link
Member

jishnub commented Sep 10, 2020

The summary might be modified to use a compact notation, displaying only the indices and not the type. Displaying the type in axes is actually in line with the Base behavior.

julia> axes(zeros(4,4))
(Base.OneTo(4), Base.OneTo(4))

@timholy
Copy link
Member

timholy commented Sep 10, 2020

How about -3ₒₐ:3ₒₐ 😆

@johnnychen94
Copy link
Member

Unfortunately, -3ₒₐ in Julia is parsed as -3 * ₒₐ so no. 😆

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 a pull request may close this issue.

4 participants