Skip to content

Non-obvious error output of f-string  #97734

Closed as not planned
Closed as not planned
@furkanonder

Description

@furkanonder

Enhancement for error output of f-string

Let's assume a f-string expression like that;

f"test (|) {|} (|) test (|)"

This statement produces a error like that;

>>> f"test (|) {|} (|) test (|)"
  File "<stdin>", line 1
    (|)
     ^
SyntaxError: f-string: invalid syntax
>>> 

Who reading this comment may be confused by thinking that the wrong part is in test (|). But the wrong part of the code is {|}.

Suggestion

If the error output is corrected in this way, the confusion will be eliminated.

>>> f"test (|) {|} (|) test (|)"
  File "<stdin>", line 1
    {|}
     ^
SyntaxError: f-string: invalid syntax
>>>

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions