Skip to content

Better show for numpy array #361

Open

Description

@xgdgsc

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

Activity

  1. cjdoris commented on Sep 21, 2023

    @cjdoris
    Member

    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?

  2. xgdgsc commented on Sep 22, 2023

    @xgdgsc
    Author

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

  3. cjdoris commented on Sep 22, 2023

    @cjdoris
    Member

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions