In the python document 2.4.3. Formatted string literals, it seems possible to write a star followed by an expression in a f-string's {}, but I cannot find how to use that.
What's that and how I can use it? Is it documented somewhere?
To be exact, this is regarding "*" or_expr part of the following BNF.
f_string          ::=  (literal_char | "{{" | "}}" | replacement_field)*
replacement_field ::=  "{" f_expression ["!" conversion] [":" format_spec] "}"
f_expression      ::=  (conditional_expression | "*" or_expr)
                         ("," conditional_expression | "," "*" or_expr)* [","]
                       | yield_expression
I tried it in REPL, but it causes an error.
>>> l = [1, 2, 3]
>>> f"{l}"
'[1, 2, 3]'
>>> f"{*l}"
  File "<stdin>", line 1
SyntaxError: can't use starred expression here
 
     
     
     
    