marimo-team/marimo

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

Opened this issue · 3 comments

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

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

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

@bluss i have a fix out for the case of sys.version_info (when an object extends list/tuple/dict): #3047