Skip to content

Commit 8dcb5c1

Browse files
committed
✨ show more arr inline
1 parent d4baa18 commit 8dcb5c1

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/Core/Py.jl

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,24 @@ function Base.show(io::IO, ::MIME"text/plain", o::Py)
192192
hasprefix = (get(io, :typeinfo, Any) != Py)::Bool
193193
compact = get(io, :compact, false)::Bool
194194
multiline = '\n' in str
195+
multilinePrefix = "Python:"
196+
if multiline
197+
if pyhasattr(o, "shape")
198+
multilinePrefix *= " " * pyrepr(String, o.shape)
199+
end
200+
if pyhasattr(o, "dtype")
201+
multilinePrefix *= " " * pyrepr(String, o.dtype)
202+
end
203+
if pyhasattr(o, "flags")
204+
if pytruth(o.flags["F_CONTIGUOUS"])
205+
multilinePrefix *= " (F order)"
206+
end
207+
end
208+
end
195209
prefix =
196210
hasprefix ?
197-
compact ? "Py:$(multiline ? '\n' : ' ')" : "Python:$(multiline ? '\n' : ' ')" : ""
211+
compact ? "Py:$(multiline ? '\n' : ' ')" :
212+
"$(multilinePrefix)$(multiline ? '\n' : ' ')" : ""
198213
print(io, prefix)
199214
h, w = displaysize(io)
200215
if get(io, :limit, true)

0 commit comments

Comments
 (0)