marimo-team / marimo

A reactive notebook for Python — run reproducible experiments, execute as a script, deploy as an app, and version with git.
https://marimo.io
Apache License 2.0
7.78k stars 274 forks source link

The output shown for types of `list` and `tuple` is identical #2665

Open anjiro opened 4 weeks ago

anjiro commented 4 weeks ago

Description

Cell output for types of list and tuple is identical if the contents of the collection is identical. For example:

Image

Suggested solution

Instead of representing a tuple as

[ 3 items
  0: 1
  1: 2
  2: 3
]

show it as

( 3 items
  0: 1
  1: 2
  2: 3
)

This would be in line with the representation of the dict type which uses curly braces.

Alternative

No response

Additional context

No response

mscolnick commented 4 weeks ago

This would maybe a be a bit tricky. These get converted to JSON types (that output is called the json-viewer), so set/list/tuple all get converted to array

bluss commented 4 weeks ago

As another vote for this issue: the default output for sys.version_info is not so easy to understand. It's a version tuple.

  1. It's hard to read it when presented as a list with every item on its own row
  2. The presentation is lossy - it's a named tuple, and the list view has lost the named fields.

Image