Skip to content

feat suggestion: transform error message due to trailing comma can be improved #2000

@dustmop

Description

@dustmop
  df = dataframe.DataFrame([["cat", datetime.datetime(year=2021, month=1, day=23)],
                            ["cat", datetime.datetime(year=2021, month=5, day=19)]
                            ["dog", datetime.datetime(year=2021, month=7, day=4)]],
                           columns=["animal","when"])

This code is missing a comma at the end of the second line. This leads to the following error message:

Traceback (most recent call last):
  .star:25:2: in <toplevel>
  .star:7:29: in f
Error: list index: got tuple, want int

We can detect this situation, and wrap the error so it displays this:

Error: list index: got tuple, want int (did you miss a trailing comma?)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions