Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[ENH]: Userepr instead ofstr in the error message #21959

Closed
Labels
Good first issueOpen a pull request against these issues if there are no active ones!New feature
Milestone
@e5f6bd

Description

@e5f6bd

Problem

I mistakenly supplied"blue\n" as the argumentc formatplotlib.axes.Axes.scatter, thenmatplitlib claimed for illegal color name like this:

ValueError: 'c' argument must be a color, a sequence of colors, or a sequence of numbers, not blue

I was not aware that the argument actually contained a trailing newline so I was very confused.

Proposed solution

The error message would be nicer if it outputs user's input viarepr.
For example, in this case the error messagehere can be easily replced with:

raiseValueError(f"'c' argument must be a color, a sequence of colors, "f"or a sequence of numbers, not{c!r}")from

so that we may now get an easy-to-troubleshoot error like this:

ValueError: 'c' argument must be a color, a sequence of colors, or a sequence of numbers, not "blue\n"

This kind of improvement can be applied to many other places.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Good first issueOpen a pull request against these issues if there are no active ones!New feature

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp