[issue43227] Backslashes in function arguments in f-string expressions

2021-02-14 Thread Eric V. Smith


Change by Eric V. Smith :


--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43227] Backslashes in function arguments in f-string expressions

2021-02-14 Thread Eric V. Smith


Eric V. Smith  added the comment:

Yes, they're prohibited anywhere inside of the braces {}.

This might be relaxed in the future, but through 3.9 it's still enforced.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43227] Backslashes in function arguments in f-string expressions

2021-02-14 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +eric.smith

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43227] Backslashes in function arguments in f-string expressions

2021-02-14 Thread Thomas Nabelek


New submission from Thomas Nabelek :

>From https://www.python.org/dev/peps/pep-0498/#escape-sequences:
"Backslashes may not appear inside the expression portions of f-strings"

Is this supposed to be true even for arguments to functions inside of the 
expression?

my_str = "test\ test\ test"
path = f"{my_str.replace(r'\ ', ' ')}"

gives

my_str = "test\ test\ test"
path = f"{my_str.replace(r'\ ', ' ')}"

SyntaxError: f-string expression part cannot include a backslash

--
messages: 386978
nosy: nabelekt
priority: normal
severity: normal
status: open
title: Backslashes in function arguments in f-string expressions
type: behavior
versions: Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com