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

Better show for numpy array #361

Open
xgdgsc opened this issue Sep 19, 2023 · 3 comments · May be fixed by #595
Open

Better show for numpy array #361

xgdgsc opened this issue Sep 19, 2023 · 3 comments · May be fixed by #595
Labels
enhancement New feature or request

Comments

@xgdgsc
Copy link

xgdgsc commented Sep 19, 2023

Is your feature request related to a problem? Please describe.

prefix = hasprefix ? compact ? "Py:$(multiline ? '\n' : ' ')" : "Python:$(multiline ? '\n' : ' ')" : ""
When it shows a python array in vscode inline results. It would only show Python when unexpanded because of the line end. Would it be better to show more informative like Julia Array shows 4×4 Matrix{Float64}: on the first line?

Describe the solution you'd like
shows numpy array shape like 4×4 Matrix{Float64}:

Describe alternatives you've considered

Additional context

@xgdgsc xgdgsc added the enhancement New feature or request label Sep 19, 2023
@cjdoris
Copy link
Collaborator

cjdoris commented Sep 21, 2023

I'm hesitant to make this code depend on the actual Python type - currently this basically just shows repr(x). I'm not totally against the idea though - I agree it's useful info.

Maybe you could suggest this change to numpy itself?

@xgdgsc
Copy link
Author

xgdgsc commented Sep 22, 2023

Would there still be a first line Python: ? How feasible is it to add something like numpy/numpy#9029 (comment) ?

@cjdoris
Copy link
Collaborator

cjdoris commented Sep 22, 2023

Oh I see your point now.

To explain for myself: when a Py is shown, if it has multiple lines then the Python: prefix occurs on its own line, such as with numpy arrays:

Python:
array(
  [ ... ], dtype=int64)

If you execute code line-by-line from a Julia script in VS Code then it only displays the first line ("Python:") which is not very informative. So this question is about adding extra info into the first line.

@xgdgsc xgdgsc linked a pull request Feb 28, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants